Subject: Why there is no records?

From: Igor Korot <[email-masked]>
Date: Mon, 16 Feb 2026 17:59:46 -0600

Hi,

draft=# SELECT n.nspname, c.oid FROM pg_constraint c, pg_namespace n
WHERE c.oid = n.oid AND c.conname = 'leagues_pkey';
 nspname | oid
---------+-----
(0 rows)

draft=# SELECT * FROM pg_constraint WHERE conname = 'leagues_pkey';
  oid  |   conname    | connamespace | contype | condeferrable |
condeferred | convalidated | conrelid | contypid | conindid |
conparentid | confrelid | confupdtype | confdeltype | confmatchtype |
conislocal | coninhcount | connoinherit | conkey | confkey | conpfeqop
| conppeqop | conffeqop | confdelsetcols | conexclop | conbin
-------+--------------+--------------+---------+---------------+-------------+--------------+----------+----------+----------+-------------+-----------+-------------+-------------+---------------+------------+-------------+--------------+--------+---------+-----------+-----------+-----------+----------------+-----------+--------
 16395 | leagues_pkey |         2200 | p       | f             | f
      | t            |    16390 |        0 |    16394 |           0 |
       0 |             |             |               | t          |
       0 | t            | {1}    |         |           |           |
        |                |           |
(1 row)

Thank you.

---

From: Adrian Klaver <[email-masked]>
Date: Mon, 16 Feb 2026 16:03:46 -0800

> WHERE c.oid = n.oid AND c.conname = 'leagues_pkey';

Because you are doing:

c.oid = n.oid

which is comparing the pg_constraint.oid to the pg_namespace.oid which 
are not the same thing.

You need:

c.connamespace = n.oid

-- 
Adrian Klaver
[email-masked]

---

From: Igor Korot <[email-masked]>
Date: Mon, 16 Feb 2026 18:15:23 -0600

Thx.