Re: different sort order for primary key index

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: different sort order for primary key index
Date: 2009-10-14 14:37:04
Message-ID: 20091014143704.GR5407@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Oct 14, 2009 at 10:29:56AM -0400, Tom Lane wrote:
> 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.

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.

--
Sam http://samason.me.uk/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Grzegorz Jaśkiewicz 2009-10-14 14:40:33 Re: different sort order for primary key index
Previous Message Tom Lane 2009-10-14 14:29:56 Re: different sort order for primary key index