Re: Why there is no records? - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Why there is no records?
Date
Msg-id b5dc7960-520b-40e1-bba8-1a2db374ec8c@aklaver.com
Whole thread Raw
In response to Why there is no records?  (Igor Korot <ikorot01@gmail.com>)
Responses Re: Why there is no records?
List pgsql-general
On 2/16/26 15:59, Igor Korot wrote:
> Hi,
> 
> draft=# SELECT n.nspname, c.oid FROM pg_constraint c, pg_namespace n
> 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


>   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.
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: Christoph Moench-Tegeder
Date:
Subject: Re: Why there is no records?
Next
From: Igor Korot
Date:
Subject: Re: Why there is no records?