From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: bad error message |
Date: | 2006-10-12 19:44:16 |
Message-ID: | 20061012194416.GA19893@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
am Thu, dem 12.10.2006, um 15:27:08 -0400 mailte Jonathan Vanasco folgendes:
>
> I got a really bad error message in postgres on a CREATE TABLE in 8.1.0:
>
> ERROR: column "id" referenced in foreign key constraint does not
> exist
>
> That seems odd-- I mean, I know I obviously made an error. I'm just
> used to more detailed errors.
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:
-- first, i create a table with a primary key
test=# create table t1 (id int primary key, foo text);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
CREATE TABLE
-- now i create a new table with a foreign key constraint to the first
-- table
test=# create table t2 (id int references t1(id));
CREATE TABLE
--
-- and now i make a mistake
--
test=# create table t3 (id int references t1(id_));
ERROR: column "id_" referenced in foreign key constraint does not exist
HTH, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
From | Date | Subject | |
---|---|---|---|
Next Message | Wei Weng | 2006-10-12 19:46:02 | Re: Question on MD5 authentication |
Previous Message | Wei Weng | 2006-10-12 19:38:18 | Question on MD5 authentication |