From: | Don Yury <yura(at)vpcit(dot)ru> |
---|---|
To: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] database design SQL prob. |
Date: | 1999-07-26 04:16:54 |
Message-ID: | 379BE136.BF6EB662@vpcit.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-sql |
"D'Arcy J.M. Cain" wrote:
>
> Not completely accurate. Create some tables using both methods then
> run the following query.
>
> SELECT pg_class.relname, pg_attribute.attname
> FROM pg_class, pg_attribute, pg_index
> WHERE pg_class.oid = pg_attribute.attrelid AND
> pg_class.oid = pg_index.indrelid AND
> pg_index.indkey[0] = pg_attribute.attnum AND
> pg_index.indisprimary = 't';
>
> This will give you a list of the primary keys if you declare them as
> primary at creation time. The ones created with just a unique index
> won't be displayed.
>
> While I am on the subject, anyone know how to enhance the above query
> to display all the fields when a complex primary key is defined? The
> above assumes that all primary keys are one field per table.
>
However, if you create table with primary key, for example
create table tab(
id int4 primary key,
...
);
and make dump of database, it will write in dump file
create table tab(
id int4,
...
);
create unique index "tab_pkey" on "tab" using btree ("id");
So, after dump / restore difference between primary key and unique index
disappears.
Is it right?
Sincerely yours, Yury.
don.web-page.net, ICQ 11831432
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Mount | 1999-07-26 05:40:51 | Hello (fwd) |
Previous Message | Michael Robinson | 1999-07-26 04:12:39 | Re: [HACKERS] A multi-lang patch for psql 6.5.1 |
From | Date | Subject | |
---|---|---|---|
Next Message | tjk@tksoft.com | 1999-07-26 04:52:42 | Re: [SQL] Expr Abbreviations/Functions? |
Previous Message | Martin Jackson | 1999-07-26 04:04:50 | (no subject) |