Re: different sort order for primary key index

Поиск
Список
Период
Сортировка
От Grzegorz Jaśkiewicz
Тема Re: different sort order for primary key index
Дата
Msg-id 2f4958ff0910140740odc5de67p63652a6d53b97aaf@mail.gmail.com
обсуждение исходный текст
Ответ на Re: different sort order for primary key index  (Sam Mason <sam@samason.me.uk>)
Список pgsql-general


On Wed, Oct 14, 2009 at 3:37 PM, Sam Mason <sam@samason.me.uk> wrote:
On Wed, Oct 14, 2009 at 10:29:56AM -0400, Tom Lane wrote:
> 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.

It also (silently) overrides any NOT NULL constraint doesn't it?  For
example:

 CREATE TABLE x ( id INT NULL PRIMARY KEY );

ends up with "id" being NOT NULL, even though I asked for it to be
nullable.  Not sure if it's useful for this case to be an error, though
it would be more in line with PG throwing errors when you asked for
something bad instead of making a best guess.

if that happens, shouldn't it be an error ? after all it could potentially confuse.

--
GJ

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

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