Re: The comment of Primary key - Mailing list pgadmin-hackers

From Dave Page
Subject Re: The comment of Primary key
Date
Msg-id 50187.80.177.99.193.1063872148.squirrel@ssl.vale-housing.co.uk
Whole thread Raw
In response to The comment of Primary key  ("Hiroshi Saito" <saito@inetrt.skcapi.co.jp>)
List pgadmin-hackers
It's rumoured that Hiroshi Saito once said:

> ----------------------------------------------------------------
> saito=# SELECT cls.oid, cls.relname as idxname, indrelid, indkey,
> indisclustered, indisunique, indisprimary, n.nspname,
>       indnatts, tab.relname as tabname, indclass, description,
>       pg_get_expr(indpred, indrelid, true) as indconstraint, contype,
>       condeferrable, condeferred, amname
>  FROM pg_index idx
>  JOIN pg_class cls ON cls.oid=indexrelid
>  JOIN pg_class tab ON tab.oid=indrelid
>  JOIN pg_namespace n ON n.oid=tab.relnamespace
>  JOIN pg_am am ON am.oid=cls.relam
>  LEFT OUTER JOIN pg_description des ON (des.objoid=cls.oid AND
>  des.objsubid = 0) LEFT OUTER JOIN pg_constraint con ON
>  con.conrelid=indrelid AND conname=cls.relname
> WHERE cls.relname = 'MyTransaction_pkey';

Hi Hiroshi,

I don't have a system to test this on at the moment so I may have missed
something...
You are joining to pg_description using pg_class.oid. This will return the
comment for the table. Try joining to pg_constraint.oid so it uses the
pkey records oid.
Regards, Dave.



pgadmin-hackers by date:

Previous
From: "Hiroshi Saito"
Date:
Subject: The comment of Primary key
Next
From: "claus"
Date:
Subject: Strange Error in Server logfile