Shorthand for foreign key indices

From: Brendan Jurd <direvus(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Shorthand for foreign key indices
Date: 2005-05-08 16:05:14
Message-ID: 37ed240d050508090539f72c37@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Does anybody else think it would be cool if you could use a shorthand
expression for creating an index on a foreign key? I think it's fair
to say that in the majority of cases, if you're using a foreign key,
you're going to want an index on it.

I know that it was decided a fair few releases ago to stop creating an
implicit index for each foreign key, and that's cool, but should the
creation syntax really require a separate statement for every single
FK you want to index?

Something like ...

CREATE TABLE foo (
foo int NOT NULL REFERENCES bar INDEX
);

... would be marvellous

My apologies if this has been answered before, but a search of the
-general mailing list was not fruitful.

BJ

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-05-08 16:38:01 Re: SQL History
Previous Message Michael Ben-Nes 2005-05-08 10:30:16 Re: SQL History