Re: different sort order for primary key index

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: different sort order for primary key index
Дата
Msg-id 12902.1255530596@sss.pgh.pa.us
обсуждение исходный текст
Ответ на different sort order for primary key index  (Paul Hartley <phartley@gmail.com>)
Ответы Re: different sort order for primary key index  (Sam Mason <sam@samason.me.uk>)
Список pgsql-general
Paul Hartley <phartley@gmail.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

В списке pgsql-general по дате отправления:

Предыдущее
От: "Chase, John"
Дата:
Сообщение: Re: COPY BINARY 8.3 to 8.4 timestamp incorrect
Следующее
От: Sam Mason
Дата:
Сообщение: Re: different sort order for primary key index