Re: explicit cast error

Поиск
Список
Период
Сортировка
От Lynn David Newton
Тема Re: explicit cast error
Дата
Msg-id 15655.16072.940886.47043@bela.interhack.net
обсуждение исходный текст
Ответ на Re: explicit cast error  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список 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



В списке pgsql-general по дате отправления:

Предыдущее
От: Hans-Juergen Schoenig
Дата:
Сообщение: PostgreSQL doesn't use indexes even is enable_seqscan = off
Следующее
От: michael_walzl@yahoo.de (Michael Walzl)
Дата:
Сообщение: Null in the where-clause