The following bug has been logged online:
Bug reference: 4182
Logged by: Rod Taylor
Email address: rod.taylor@gmail.com
PostgreSQL version: 8.3.1
Operating system: amd64-portbld-freebsd7.0, compiled by GCC cc (GCC) 4.2.1
20070719 [FreeBSD]
Description: Enum in Foreign Key broken
Details:
The Update in the below script results in the following
ERROR: no conversion function from some_enum to anyenum
CREATE TYPE some_enum AS ENUM('Value 1', 'Value 2');
CREATE TABLE t1
( col1 varchar(10)
, col2 some_enum
, testboolean boolean
, PRIMARY KEY(col1, col2)
);
CREATE TABLE t2
( col1 varchar(10)
, col2 some_enum
, PRIMARY KEY(col1, col2)
, FOREIGN KEY (col1, col2) REFERENCES t1(col1, col2) on update cascade on
delete restrict
);
INSERT INTO t1 VALUES ('varcharval', 'Value 1');
INSERT INTO t1 VALUES ('varcharval', 'Value 2');
INSERT INTO t2 VALUES ('varcharval', 'Value 1');
UPDATE t1 SET testboolean = false;
-- ERROR: no conversion function from some_enum to anyenum