From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Paul Hartley <phartley(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: different sort order for primary key index |
Date: | 2009-10-14 14:29:56 |
Message-ID: | 12902.1255530596@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Paul Hartley <phartley(at)gmail(dot)com> writes:
> ... I'm unclear
> if PostgreSQL treats primary keys differently from unique, non-null
> constraints.
The *only* thing that the system does specially with a primary key
constraint is that a PK creates a default column target for foreign key
references. For example,
create table m (id int primary key);
create table s (refid int references m);
versus
create table m (id int);
create unique index mi on m (id);
create table s (refid int references m(id));
I have to spell out "(id)" in that last command because there's no PK
to establish a default target.
Other than that, behavior and performance should be the same. The
planner and executor only care about the indexes, not about whatever
constraints they might have come from. Likewise, NOT NULL is NOT NULL
regardless of what syntax you used to slap it onto the column.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Sam Mason | 2009-10-14 14:37:04 | Re: different sort order for primary key index |
Previous Message | Chase, John | 2009-10-14 14:28:47 | Re: COPY BINARY 8.3 to 8.4 timestamp incorrect |