ERROR: UNIQUE constraint ... not found? - Mailing list pgsql-general

From Ed L.
Subject ERROR: UNIQUE constraint ... not found?
Date
Msg-id 200304021531.07990.pgsql@bluepolka.net
Whole thread Raw
Responses Re: ERROR: UNIQUE constraint ... not found?  ("Ed L." <pgsql@bluepolka.net>)
Re: ERROR: UNIQUE constraint ... not found?  (Dennis Gearon <gearond@cvc.net>)
Re: ERROR: UNIQUE constraint ... not found?  ("Nigel J. Andrews" <nandrews@investsystems.co.uk>)
List pgsql-general
Well, I've stared at this little riddle for long enough.  Anyone see a
mistake?

$ cat test.sql
SELECT version();

CREATE TABLE person (
        id      SERIAL,
        name    VARCHAR NOT NULL
);

CREATE TABLE session (
        id                      SERIAL,
        person_id               INTEGER NOT NULL,
        FOREIGN KEY (person_id) REFERENCES person (id)
);



$ dropdb drilldb; createdb drilldb; psql -e -d drilldb -f test.sql
DROP DATABASE
CREATE DATABASE
SELECT version();
                                                 version
---------------------------------------------------------------------------------------------------------
 PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2
20020903 (Red Hat Linux 8.0 3.2-7)
(1 row)

CREATE TABLE person (
        id      SERIAL,
        name    VARCHAR NOT NULL
);
psql:test.sql:6: NOTICE:  CREATE TABLE will create implicit sequence
'person_id_seq' for SERIAL column 'person.id'
CREATE TABLE
CREATE TABLE session (
        id                      SERIAL,
        person_id               INTEGER NOT NULL,
        FOREIGN KEY (person_id) REFERENCES person (id)
);
psql:test.sql:12: NOTICE:  CREATE TABLE will create implicit sequence
'session_id_seq' for SERIAL column 'session.id'
psql:test.sql:12: NOTICE:  CREATE TABLE will create implicit trigger(s) for
FOREIGN KEY check(s)
psql:test.sql:12: ERROR:  UNIQUE constraint matching given keys for
referenced table "person" not found


pgsql-general by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: Backend often crashing
Next
From: "Ed L."
Date:
Subject: Re: ERROR: UNIQUE constraint ... not found?