domain over enum problem
CREATE TYPE zzz_enum AS ENUM ('A', 'B', 'C');
CREATE TABLE zzz_test1 (z zzz_enum);
SELECT * FROM zzz_test1 WHERE z = 'A';
That works. But:
CREATE DOMAIN zzz AS zzz_enum DEFAULT 'A';
CREATE TABLE zzz_test2 (z zzz);
SELECT * FROM zzz_test2 WHERE z = 'A';
ERROR: 42883: operator does not exist: zzz = unknown
Peter Eisentraut <peter_e@gmx.net> writes:
CREATE TYPE zzz_enum AS ENUM ('A', 'B', 'C');
CREATE TABLE zzz_test1 (z zzz_enum);
SELECT * FROM zzz_test1 WHERE z = 'A';
That works. But:
CREATE DOMAIN zzz AS zzz_enum DEFAULT 'A';
CREATE TABLE zzz_test2 (z zzz);
SELECT * FROM zzz_test2 WHERE z = 'A';
ERROR: 42883: operator does not exist: zzz = unknown
I suppose this is because enforce_generic_type_consistency doesn't smash
domains to base types before checking type_is_enum. I'm a bit hesitant
to change that though. We don't smash to base types before checking if
a domain matches an anyarray, and I seem to recall that that's
intentional.
regards, tom lane