Re: domain over enum problem - Mailing list pgsql-bugs

From Tom Lane
Subject Re: domain over enum problem
Date
Msg-id 2971.1294769104@sss.pgh.pa.us
Whole thread Raw
In response to domain over enum problem  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: domain over enum problem
Next
From: Pavel Stehule
Date:
Subject: Re: BUG #5831: Splitting string into char array with string_to_array does not work