8.2/8.3 incompatibility

From: Harald Fuchs <hari(dot)fuchs(at)googlemail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: 8.2/8.3 incompatibility
Date: 2008-02-07 13:04:38
Message-ID: pu1w7ogbo9.fsf@srv.protecting.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Stark 2008-02-07 13:12:44 Re: Subquery Factoring ?
Previous Message Andrey Stoev 2008-02-07 12:23:54 Need help with decoding of sql array from WAL files version 7.4.17