Skip to content

db2fce

db2fce : DB2 compatibility functions, types, operators, and SYSIBM.SYSDUMMY1 for PostgreSQL.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
9200
db2fce
db2fce
0.0.17
SIM
PostgreSQL
SQL
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
----d--
No
No
No
Yes
no
no
Relationships
Schemasdb2 sysibm
Requires
plpgsql
See Also
orafce
pg_dbms_metadata
pg_dbms_job

PGDG APT is complete for PG14-18; Pigsty RPM noarch spec fills the PGDG YUM gap for PG14-18.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
MIXED
0.0.17
18
17
16
15
14
db2fceplpgsql
RPM
PIGSTY
0.0.17
18
17
16
15
14
db2fce_$v-
DEB
PGDG
0.0.17
18
17
16
15
14
postgresql-$v-db2fce-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
el8.aarch64
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
el9.x86_64
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
el9.aarch64
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
el10.x86_64
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
el10.aarch64
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
PIGSTY 0.0.17
d12.x86_64
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
d12.aarch64
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
d13.x86_64
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
d13.aarch64
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
u22.x86_64
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
u22.aarch64
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
u24.x86_64
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
u24.aarch64
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
u26.x86_64
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
u26.aarch64
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17
PGDG 0.0.17

Source

pig build pkg db2fce;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install db2fce;		# install via package name, for the active PG version

pig install db2fce -v 18;   # install for PG 18
pig install db2fce -v 17;   # install for PG 17
pig install db2fce -v 16;   # install for PG 16
pig install db2fce -v 15;   # install for PG 15
pig install db2fce -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION db2fce CASCADE; -- requires plpgsql

Usage

Sources: README, SQL objects, control file

db2fce provides a DB2 compatibility environment for PostgreSQL. It creates DB2-style functions, types, operators, and the SYSIBM.SYSDUMMY1 compatibility view so SQL originally written for IBM Db2 can be adapted with fewer changes.

Enable

CREATE EXTENSION db2fce;

SET search_path = db2, sysibm, public;

The extension creates most compatibility objects in the db2 schema and creates sysibm.sysdummy1 for DB2 queries that expect a dummy single-row table.

SELECT * FROM sysibm.sysdummy1;

Compatibility Functions

The db2 schema includes date/time helpers such as microsecond, second, minute, hour, day, month, year, days, months_between, date, time, and timestamp_format.

String and conversion helpers include locate, translate, lcase, upper, lower, strip, char, integer, int, double, decimal, dec, hex, round, digits, and value.

Operators

The SQL layer also defines DB2-style operators such as ^= for inequality and !! for concatenation across several data types.

SELECT db2.int('42');
SELECT db2.days(current_date);
SELECT 'db' !! '2';

Notes

Adding db2 to search_path lets many DB2 function calls work without schema qualification. Some names that conflict with PostgreSQL syntax or built-in behavior may still need explicit db2. qualification.

Last updated on