| From: | Jason Davies <jason_ddavies(at)yahoo(dot)com> |
|---|---|
| To: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | unique indexes |
| Date: | 2000-11-19 16:42:36 |
| Message-ID: | 20001119164236.15356.qmail@web204.mail.yahoo.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dan Wilson | 2000-11-19 17:33:49 | DB and Table Permissions |
| Previous Message | Peter Eisentraut | 2000-11-19 10:53:42 | Re: Changing row limit... |