From: Don Yury <yura@vpcit.ru>
To: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] database design SQL prob.
Date: Mon, 26 Jul 1999 10:16:54 +0600
Message-ID: <379BE136.BF6EB662@vpcit.ru> (raw)
References: <m1180J8-0000bFC@druid.net>
"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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: yura@vpcit.ru
Subject: Re: [SQL] database design SQL prob.
In-Reply-To: <379BE136.BF6EB662@vpcit.ru>
References: <m1180J8-0000bFC@druid.net> <379BE136.BF6EB662@vpcit.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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