primary key query

From: Shuying Wang <wang(dot)shuying(dot)lists(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: primary key query
Date: 2005-11-03 00:46:58
Message-ID: bbf221f60511021646w193690bek4496a8d41e50ae2e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Dean 2005-11-03 00:47:10 help
Previous Message Michael Dean 2005-11-02 23:21:39 integrating postgres ande drupal