Re: 7.4 - TODO : alter table drop foreign key

From: "Dan Langille" <dan(at)langille(dot)org>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 7.4 - TODO : alter table drop foreign key
Date: 2002-12-05 18:45:19
Message-ID: 3DEF586F.835.6F0FA3B@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5 Dec 2002 at 9:51, Stephan Szabo wrote:

> On Thu, 5 Dec 2002, Dan Langille wrote:
>
> > On 5 Dec 2002 at 9:31, Stephan Szabo wrote:
> >
> > > When we talk about ALTER TABLE ADD FOREIGN KEY we're being imprecise, so
> > > I think that might be why we're talking past each other here.
> > >
> > > Technically the syntax in question is:
> > > ALTER TABLE <table> ADD <table constraint definition>
> > > where CONSTRAINT <name> is an optional leading clause in a table
> > > constraint definition. ADD FOREIGN KEY is a shorthand for a foreign key
> > > constraint (technically unnamed).
> >
> > Understood.
> >
> > What about allowing a named foreign key? I haven't checked the RFCs
>
> Here's a part of what SQL92 (draft) has to say about table constraint
> definitions:
>
> <table constraint definition> ::=
> [ <constraint name definition> ]
> <table constraint> [ <constraint attributes> ]
>
> <table constraint> ::=
> <unique constraint definition>
> | <referential constraint definition>
> | <check constraint definition>
>
>
> <constraint name definition> ::= CONSTRAINT <constraint name>
>
> <referential constraint definition> ::=
> FOREIGN KEY <left paren> <referencing columns> <right paren>
> <references specification>
>
> 11.6 Syntax Rules
>
> 2) If <constraint name definition> is not specified, then a <con-
> straint name definition> that contains an implementation-
> dependent <constraint name> is implicit. The assigned <con-
> straint name> shall obey the Syntax Rules of an explicit <con-
> straint name>.
>
> In our case, the implementation dependent naming scheme is I believe
> "$<n>" where <n> is the maximum one already there for that table +1 I
> would guess.

Thanks. I guess I should rename my thread to 7.4 - TODO : allow
constraint names when using the "ALTER TABLE <table> ADD FOREIGN KEY"
syntax.
--
Dan Langille : http://www.langille.org/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul Ramsey 2002-12-05 18:49:03 7.3 pg_relcheck oddness
Previous Message mlw 2002-12-05 17:52:29 Re: Shrinkwrap Windows Product, any issues? Anyone? (postmaster windows