8.2/8.3 incompatibility - Mailing list pgsql-general

From Harald Fuchs
Subject 8.2/8.3 incompatibility
Date
Msg-id pu1w7ogbo9.fsf@srv.protecting.net
Whole thread Raw
Responses Re: 8.2/8.3 incompatibility
Re: 8.2/8.3 incompatibility
List pgsql-general
I've found an incompatibility between PostgreSQL 8.2.4 and 8.3.0 which
is not clearly documented.  Here's a short example:

  CREATE TABLE t1 (
    id CHAR(5) NOT NULL,
    PRIMARY KEY (id)
  );

  INSERT INTO t1 (id) VALUES ('t1id1');
  INSERT INTO t1 (id) VALUES ('t1id2');
  INSERT INTO t1 (id) VALUES ('t1id3');

  CREATE TABLE t2 (
    id SERIAL NOT NULL,
    t1id VARCHAR(5) NOT NULL,
    PRIMARY KEY (id)
  );

  INSERT INTO t2 (t1id) VALUES ('t1id1');
  INSERT INTO t2 (t1id) VALUES ('t1id2');
  INSERT INTO t2 (t1id) VALUES ('t1id3');

  ALTER TABLE t2
  ADD CONSTRAINT t2_t1id_fk
  FOREIGN KEY (t1id) REFERENCES t1 (id);

(Note the different column types.)

This works fine in 8.2.4, but 8.3.0 rejects the ALTER TABLE with the
following (somewhat misleading) error message:

  ERROR:  insert or update on table "t2" violates foreign key constraint "t2_t1id_fk"
  DETAIL:  Key (t1id)=(t1id1) is not present in table "t1".

Should this be documented explicitly?
Should the error message look different?

pgsql-general by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Subquery Factoring ?
Next
From: Gregory Stark
Date:
Subject: Re: Kernel kills postgres process - help need