8.2/8.3 incompatibility

Поиск
Список
Период
Сортировка
От Harald Fuchs
Тема 8.2/8.3 incompatibility
Дата
Msg-id pu1w7ogbo9.fsf@srv.protecting.net
обсуждение исходный текст
Ответы Re: 8.2/8.3 incompatibility
Re: 8.2/8.3 incompatibility
Список 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 по дате отправления:

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: Subquery Factoring ?
Следующее
От: Gregory Stark
Дата:
Сообщение: Re: Kernel kills postgres process - help need