db2fce

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

Overview

PackageVersionCategoryLicenseLanguage
db2fce0.0.17SIMPostgreSQLSQL
IDExtensionBinLibLoadCreateTrustRelocSchema
9200db2fceNoNoNoYesNoNodb2
Relatedplpgsql 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.

Version

TypeRepoVersionPG VerPackageDeps
EXTMIXED0.0.171817161514db2fceplpgsql
RPMPIGSTY0.0.171817161514db2fce_$v-
DEBPGDG0.0.171817161514postgresql-$v-db2fce-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
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

Build

You can build the RPM / DEB packages for db2fce using pig build:

pig build pkg db2fce         # build RPM / DEB packages

Install

You can install db2fce directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

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

Install the extension using pig or apt/yum/dnf:

pig install db2fce;          # Install for current active PG version
pig ext install -y db2fce -v 18  # PG 18
pig ext install -y db2fce -v 17  # PG 17
pig ext install -y db2fce -v 16  # PG 16
pig ext install -y db2fce -v 15  # PG 15
pig ext install -y db2fce -v 14  # PG 14
dnf install -y db2fce_18       # PG 18
dnf install -y db2fce_17       # PG 17
dnf install -y db2fce_16       # PG 16
dnf install -y db2fce_15       # PG 15
dnf install -y db2fce_14       # PG 14
apt install -y postgresql-18-db2fce   # PG 18
apt install -y postgresql-17-db2fce   # PG 17
apt install -y postgresql-16-db2fce   # PG 16
apt install -y postgresql-15-db2fce   # PG 15
apt install -y postgresql-14-db2fce   # PG 14

Create Extension:

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 Modified 2026-07-02: extension update 2026-07-02 (f9f0d13)