On Oct 12, 2006, at 3:44 PM, A. Kretschmer wrote:

Can you show us your SQL? The message is clear: you create a new table
with a foreign key to an other table that doesn't exist. An example:

Yes, I know that part. The error message is bad though, because it doesn't tell me exactly where the error is.

I got as an error
        ERROR:  column "id" referenced in foreign key constraint does not exist

I should have gotten something like
ERROR: column "id" referenced in foreign key constraint on column "xyz" table "abc" does not exist

( the table "abc" is not necessary, i just wanted to be explicit about the message )

In that create table statement, i had 10 columns each referencing an 'id' in another column. I like very normalized DBs.

I had to go through each column individually to see where my error was. Postgres should have immediately told me which of the source table columns that constraint failed on-- not just about the target column name.



---------------------------(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

Reply via email to