public inbox for [email protected]
help / color / mirror / Atom feedBUG #19444: conkey field empty for domain NOT NULL constraint in pg_constraint (18.3)
3+ messages / 3 participants
[nested] [flat]
* BUG #19444: conkey field empty for domain NOT NULL constraint in pg_constraint (18.3)
@ 2026-03-30 03:10 PG Bug reporting form <[email protected]>
0 siblings, 2 replies; 3+ messages in thread
From: PG Bug reporting form @ 2026-03-30 03:10 UTC (permalink / raw)
To: [email protected]; +Cc: [email protected]
The following bug has been logged on the website:
Bug reference: 19444
Logged by: Xianghang Zheng
Email address: [email protected]
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #19444: conkey field empty for domain NOT NULL constraint in pg_constraint (18.3)
@ 2026-03-30 14:17 Junwang Zhao <[email protected]>
parent: PG Bug reporting form <[email protected]>
1 sibling, 0 replies; 3+ messages in thread
From: Junwang Zhao @ 2026-03-30 14:17 UTC (permalink / raw)
To: [email protected]; [email protected]
On Mon, Mar 30, 2026 at 7:52 PM PG Bug reporting form
<[email protected]> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference: 19444
> Logged by: Xianghang Zheng
> Email address: [email protected]
> 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.
>
>
I think you have interpreted this incorrectly, domain is a type, not a relation.
See the comments in pg_constraint.h for clarification.
/*
* conrelid and conkey are only meaningful if the constraint applies to a
* specific relation (this excludes domain constraints and assertions).
* Otherwise conrelid is 0 and conkey is NULL.
*/
>
>
--
Regards
Junwang Zhao
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #19444: conkey field empty for domain NOT NULL constraint in pg_constraint (18.3)
@ 2026-03-30 18:44 Tom Lane <[email protected]>
parent: PG Bug reporting form <[email protected]>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2026-03-30 18:44 UTC (permalink / raw)
To: [email protected]; +Cc: [email protected]
PG Bug reporting form <[email protected]> writes:
> 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.
I do not think this is a bug. The system catalog documentation says
conkey int2[] (references pg_attribute.attnum)
If a table constraint (including foreign keys, but not
constraint triggers), list of the constrained columns
So (a) this is not a table constraint, and (b) a domain does not have
columns.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-03-30 18:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-30 03:10 BUG #19444: conkey field empty for domain NOT NULL constraint in pg_constraint (18.3) PG Bug reporting form <[email protected]>
2026-03-30 14:17 ` Junwang Zhao <[email protected]>
2026-03-30 18:44 ` Tom Lane <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox