From: | Lynn David Newton <lynn(dot)newton(at)cox(dot)net> |
---|---|
To: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
Cc: | Lynn David Newton <lynn(dot)newton(at)cox(dot)net>, Thomas Lockhart <lockhart(at)fourpalms(dot)org>, Andrew Sullivan <andrew(at)libertyrms(dot)info>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Joe Conway <mail(at)joeconway(dot)com>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: explicit cast error |
Date: | 2002-07-06 19:02:32 |
Message-ID: | 15655.16072.940886.47043@bela.interhack.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> ...>
>> foreign key (dset) references datasets
Stephan> In abc, you've got a text field and in def
Stephan> it's refrencing the primary key which is an
Stephan> int. That's not allowed. If you were running
Stephan> 7.2 it would have errored when you tried to
Stephan> make the table. Perhaps you mean for
Stephan> abc(dlab) to reference def(dlab) in which
Stephan> case the constraint should read:
Stephan> foreign key(dlab) refrences def(dlab)
Ack! Of course, of course, of course ...
My problem is now solved. Having close to zero
experience, and having extrapolated syntax for the
foreign key statement from an example full of foos and
ellipses, I assumed that the argument to 'references'
was simplay a table name and that it would look for a
column by the same *name* as the one referred to in the
calling table. I now see that doesn't make a lot of
sense, and that the actual field name in the other
table needs to be specified, even if it's the same
name, unless the default primary key is intended.
I would have eventually discovered that, if I'd read
only another 5-600 pages of manual.
Thank you very much.
--
Lynn David Newton
Phoenix, AZ
From | Date | Subject | |
---|---|---|---|
Next Message | Rich Shepard | 2002-07-06 19:08:10 | Re: I am being interviewed by OReilly |
Previous Message | Oleg Bartunov | 2002-07-06 18:49:31 | Re: I am being interviewed by OReilly |