pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedquery system tables to find columns unique constraint is constraining?
3+ messages / 3 participants
[nested] [flat]
* query system tables to find columns unique constraint is constraining?
@ 2002-05-28 18:47 Beth Gatewood <beth@vizxlabs.com>
2002-05-28 19:10 ` Re: query system tables to find columns unique constraint is constraining? Tom Lane <tgl@sss.pgh.pa.us>
2002-05-28 21:12 ` Re: query system tables to find columns unique constraint is constraining? Christopher Kings-Lynne <chriskl@familyhealth.com.au>
0 siblings, 2 replies; 3+ messages in thread
From: Beth Gatewood @ 2002-05-28 18:47 UTC (permalink / raw)
To: pgsql-sql
Hi-
I have been fiddling around trying to figure out which columns some unique
constraints are constraining by querying the system tables.....with zero
luck.
Can anyone suggest how to do this?
thank!
Beth
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: query system tables to find columns unique constraint is constraining?
2002-05-28 18:47 query system tables to find columns unique constraint is constraining? Beth Gatewood <beth@vizxlabs.com>
@ 2002-05-28 19:10 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2002-05-28 19:10 UTC (permalink / raw)
To: Beth Gatewood <beth@vizxlabs.com>; +Cc: pgsql-sql
"Beth Gatewood" <beth@vizxlabs.com> writes:
> I have been fiddling around trying to figure out which columns some unique
> constraints are constraining by querying the system tables.....with zero
> luck.
Look at the pg_index row for the index that's implementing the
constraint.
Rather than messing with the pg_index entry directly, you might want to
use pg_get_indexdef(), which is a helper function for pg_dump:
regression=# create table foo (f1 int, constraint foo_f1 unique (f1));
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'foo_f1' for table 'foo'
CREATE TABLE
regression=# select pg_get_indexdef(oid) from pg_class where relname = 'foo_f1';
pg_get_indexdef
----------------------------------------------------
CREATE UNIQUE INDEX foo_f1 ON foo USING btree (f1)
(1 row)
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: query system tables to find columns unique constraint is constraining?
2002-05-28 18:47 query system tables to find columns unique constraint is constraining? Beth Gatewood <beth@vizxlabs.com>
@ 2002-05-28 21:12 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
1 sibling, 0 replies; 3+ messages in thread
From: Christopher Kings-Lynne @ 2002-05-28 21:12 UTC (permalink / raw)
To: Beth Gatewood <beth@vizxlabs.com>; pgsql-sql
It's all in the pg_index table. Check for unique indices.
Chris
----- Original Message -----
From: "Beth Gatewood" <beth@vizxlabs.com>
To: <pgsql-sql@postgresql.org>
Sent: Tuesday, May 28, 2002 11:47 AM
Subject: [SQL] query system tables to find columns unique constraint is
constraining?
>
>
> Hi-
>
> I have been fiddling around trying to figure out which columns some unique
> constraints are constraining by querying the system tables.....with zero
> luck.
>
> Can anyone suggest how to do this?
>
> thank!
> Beth
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2002-05-28 21:12 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-05-28 18:47 query system tables to find columns unique constraint is constraining? Beth Gatewood <beth@vizxlabs.com>
2002-05-28 19:10 ` Tom Lane <tgl@sss.pgh.pa.us>
2002-05-28 21:12 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox