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/