From: | Bas van der Linden <bas(at)mike(dot)amaze(dot)nl> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | References not being checked while creating tables? |
Date: | 2001-03-16 17:55:39 |
Message-ID: | 20010316185539.G23402@amaze.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)amaze(dot)nl Web: http://www.amaze.nl/
From | Date | Subject | |
---|---|---|---|
Next Message | Laurel Williams | 2001-03-16 18:06:58 | installing/running ODBC |
Previous Message | Dax Duskin | 2001-03-16 17:37:40 | perl problems part 2 |