Re: The comment of Primary key

Поиск
Список
Период
Сортировка
От Dave Page
Тема Re: The comment of Primary key
Дата
Msg-id 50187.80.177.99.193.1063872148.squirrel@ssl.vale-housing.co.uk
обсуждение исходный текст
Ответ на The comment of Primary key  ("Hiroshi Saito" <saito@inetrt.skcapi.co.jp>)
Список 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 по дате отправления:

Предыдущее
От: "Hiroshi Saito"
Дата:
Сообщение: The comment of Primary key
Следующее
От: "claus"
Дата:
Сообщение: Strange Error in Server logfile