Thread: references versus foreign keys

references versus foreign keys

From
Tom Allison
Date:
Maybe this is too much of a noob question but bear with me.

I'm assuming that I have a choice between
CREATE TABLE (..) REFERENCES other
and
CREATE TABLE (..) FOREIGN KEY () REFERENCES other
What is the differences between the two and why/when would I choose one over the
other?

Re: references versus foreign keys

From
Tom Lane
Date:
Tom Allison <tallison@tacocat.net> writes:
> Maybe this is too much of a noob question but bear with me.
> I'm assuming that I have a choice between
> CREATE TABLE (..) REFERENCES other
> and
> CREATE TABLE (..) FOREIGN KEY () REFERENCES other
> What is the differences between the two and why/when would I choose one over the
> other?

You have to use the more verbose syntax to establish a multi-column
reference.  For single-column keys it doesn't matter which way you
do it.

            regards, tom lane