pgschema icon indicating copy to clipboard operation
pgschema copied to clipboard

`pgschema dump` drops `NULLS NOT DISTINCT` from `UNIQUE` table constraints

Open ivgiuliani opened this issue 7 months ago • 0 comments

Given the following schema with a table-level UNIQUE constraint using the NULLS NOT DISTINCT modifier:

CREATE TABLE pgschema_repro_nulls (
    a integer,
    b integer,
    CONSTRAINT pgschema_repro_nulls_uniq UNIQUE NULLS NOT DISTINCT (a, b)
);

pgschema dump silently drops the modifier by returning the following DDL:

CREATE TABLE IF NOT EXISTS pgschema_repro_nulls (
    a integer,
    b integer,
    CONSTRAINT pgschema_repro_nulls_uniq UNIQUE (a, b)
);

The same modifier seems to be preserved correctly on standalone CREATE UNIQUE INDEX ... NULLS NOT DISTINCT (see #355).

(NULLS NOT DISTINCT was introduced in PostgreSQL 15).

ivgiuliani avatar Apr 27 '26 18:04 ivgiuliani