This is a discussion on references versus foreign keys within the pgsql Novice forums, part of the PostgreSQL category; --> Maybe this is too much of a noob question but bear with me. I'm assuming that I have a ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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? ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match |
| ||||
| 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 ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend |