From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Dan Langille <dan(at)langille(dot)org> |
Cc: | <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: 7.4 - TODO : alter table drop foreign key |
Date: | 2002-12-05 17:51:26 |
Message-ID: | 20021205094312.F2765-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | mlw | 2002-12-05 17:52:29 | Re: Shrinkwrap Windows Product, any issues? Anyone? (postmaster windows |
Previous Message | Dan Langille | 2002-12-05 17:41:29 | Re: 7.4 - TODO : alter table drop foreign key |