BUG #19444: conkey field empty for domain NOT NULL constraint in pg_constraint (18.3)

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: zheng_xianghang(at)163(dot)com
Subject: BUG #19444: conkey field empty for domain NOT NULL constraint in pg_constraint (18.3)
Date: 2026-03-30 03:10:45
Message-ID: 19444-21f73da373fc0f58@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19444
Logged by: Xianghang Zheng
Email address: zheng_xianghang(at)163(dot)com
PostgreSQL version: 18.3
Operating system: Linux x86_64
Description:

When creating a domain with a NOT NULL constraint, the conkey field in
pg_constraint remains empty. This is inconsistent with table-level NOT
NULL constraints, which correctly populate the conkey field.

Version: PostgreSQL 18.3 (x86_64)
Platform: Linux x86_64

Steps to Reproduce:
-------------------
CREATE DOMAIN my_domain AS text NOT NULL;

SELECT conname, contype, conkey, contypid::regtype
FROM pg_constraint
WHERE contypid = 'my_domain'::regtype;

Actual Result:
--------------
conname | contype | conkey | contypid
--------------------+---------+--------+-----------
my_domain_not_null | n | | my_domain
(1 row)

Expected Result:
----------------
The conkey field should contain {1} (the first and only column of the
domain):

conname | contype | conkey | contypid
--------------------+---------+--------+-----------
my_domain_not_null | n | {1} | my_domain

Additional Information:
-----------------------
- The NOT NULL constraint works correctly (rejects NULL values)
- The issue is only with the system catalog metadata
- This may affect tools like pg_dump, pg_upgrade, or extensions that rely
on the conkey field for domain constraints
- Table-level NOT NULL constraints correctly populate conkey:

CREATE TABLE test_table (id text NOT NULL);
SELECT conname, contype, conkey FROM pg_constraint
WHERE conrelid = 'test_table'::regclass;

Result: test_table_id_not_null | n | {1}

Please let me know if you need any additional information or testing.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2026-03-30 03:11:35 BUG #19445: Domain DEFAULT not recorded in pg_attrdef (atthasdef false) in PostgreSQL 18.3
Previous Message PG Bug reporting form 2026-03-30 03:09:55 BUG #19443: GIN jsonb_path_ops index not used when many rows contain nested null values (PostgreSQL 18.3)