BUG #4182: Enum in Foreign Key broken - Mailing list pgsql-bugs

From Rod Taylor
Subject BUG #4182: Enum in Foreign Key broken
Date
Msg-id 200805181905.m4IJ5kTA086292@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4182: Enum in Foreign Key broken  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #4180: PANIC while PQExec on Client with differen locale from database
Next
From: Tom Lane
Date:
Subject: Re: BUG #4182: Enum in Foreign Key broken