unique indexes - Mailing list pgsql-general

From Jason Davies
Subject unique indexes
Date
Msg-id 20001119164236.15356.qmail@web204.mail.yahoo.com
Whole thread Raw
List pgsql-general
Hi,

Thankyou for your help with pg_trigger :)

I am trying to list the indexes for a table. So far I've come up with this SQL
query:

SELECT bc.relname AS TABLE_NAME,
a.attname AS COLUMN_NAME,
a.attnum as KEY_SEQ,
ic.relname as PK_NAME
FROM pg_class bc, pg_class ic, pg_index i, pg_attribute a
WHERE bc.relkind = 'r'
 and upper(bc.relname) = upper('tablename')
 and i.indrelid = bc.oid
 and i.indexrelid = ic.oid
 and ic.oid = a.attrelid
 ORDER BY table_name, pk_name, key_seq;

I need to extend it slightly to get whether each key is unique or not. Any
ideas on how this might be done?

I would be grateful for any help.
Thanks,
Jason Davies.

=====
Jason Davies,

 _  _ _|_ _ _  _  _| _    | www.netspade.com
| |(/_ | _\|_)(_|(_|(/_   | programming tutorials
           |              | programming community
-----------------------   | programming news

__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/

pgsql-general by date:

Previous
From: "Dan Wilson"
Date:
Subject: DB and Table Permissions
Next
From: "Dan Wilson"
Date:
Subject: Re: unique indexes