primary key query - Mailing list pgsql-novice

From Shuying Wang
Subject primary key query
Date
Msg-id bbf221f60511021646w193690bek4496a8d41e50ae2e@mail.gmail.com
Whole thread Raw
Responses Re: primary key query
List 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 by date:

Previous
From: George Weaver
Date:
Subject: Re: Missing data in Information Schema
Next
From: Michael Fuhr
Date:
Subject: Re: primary key query