References not being checked while creating tables?
От | Bas van der Linden |
---|---|
Тема | References not being checked while creating tables? |
Дата | |
Msg-id | 20010316185539.G23402@amaze.nl обсуждение исходный текст |
Ответы |
Re: References not being checked while creating tables?
|
Список | pgsql-novice |
Hi all, I've just started learning SQL, wich is great fun. However, there's something I don't understand, wich has to do with references. Take this example: CREATE TABLE test ( id serial ); CREATE TABLE test2 ( another_id REFERENCES test(id) ); This doesn't work, because I didn't tell the database what data type to use for another_id. However, my point is that it _is_ able to deduct what data type to use for another_id, as it is a reference to something I have defined. And something related: CREATE TABLE test ( id serial ); CREATE TABLE test2 ( another_id text REFERENCES test(id) ); This is accepted by the database, however, it obviously is of no use whatsoever as the data types are incompatible. What am I missing or overseeing here? (Or to refrase the question: Why is it not checking this and who do I have to suck up to in order to get this implemented? :) Thanks in advance! Bas van der Linden -- B.J.J. van der Linden Amaze Internet Services V.O.F. Brouwersgracht 132 Tel: 020-4688336 1013 HA Amsterdam Fax: 020-4688337 Email: bas@amaze.nl Web: http://www.amaze.nl/
В списке pgsql-novice по дате отправления: