primary key query

Поиск
Список
Период
Сортировка
От Shuying Wang
Тема primary key query
Дата
Msg-id bbf221f60511021646w193690bek4496a8d41e50ae2e@mail.gmail.com
обсуждение исходный текст
Ответы Re: primary key query  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-novice
Hi,

I've got a table with the following schema:

create table enumerations.eligibility_type (
        id serial primary key
) inherits (enumerations.enumeration);

However if I do:
SELECT pg_index.indisprimary,
            pg_catalog.pg_get_indexdef(pg_index.indexrelid)
        FROM pg_catalog.pg_class c, pg_catalog.pg_class c2,
            pg_catalog.pg_index AS pg_index
        WHERE c.relname = 'enumerations.eligibility_type'
       AND c.oid = pg_index.indrelid
      AND pg_index.indexrelid = c2.oid AND pg_index.indisprimary;

I get nothing but if I do:
SELECT pg_index.indisprimary,
pg_catalog.pg_get_indexdef(pg_index.indexrelid)
FROM pg_catalog.pg_class c, pg_catalog.pg_class c2,
pg_catalog.pg_index AS pg_index
WHERE c.relname = 'eligibility_type' AND c.oid = pg_index.indrelid AND
pg_index.indexrelid = c2.oid AND pg_index.indisprimary;

I get:
 indisprimary |                                       pg_get_indexdef
--------------+---------------------------------------------------------------------------------------------
 t            | CREATE UNIQUE INDEX eligibility_type_pkey ON
enumerations.eligibility_type USING btree (id)

Why is relname 'eligibility_type' and not 'enumerations.eligibility_type'?

Cheers,
Shuying

В списке pgsql-novice по дате отправления:

Предыдущее
От: George Weaver
Дата:
Сообщение: Re: Missing data in Information Schema
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: primary key query