pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
domain over enum problem
2+ messages / 2 participants
[nested] [flat]

* domain over enum problem
@ 2011-01-11 17:37 Peter Eisentraut <peter_e@gmx.net>
  2011-01-11 18:05 ` Re: domain over enum problem Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Peter Eisentraut @ 2011-01-11 17:37 UTC (permalink / raw)
  To: pgsql-bugs

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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: domain over enum problem
  2011-01-11 17:37 domain over enum problem Peter Eisentraut <peter_e@gmx.net>
@ 2011-01-11 18:05 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2011-01-11 18:05 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2011-01-11 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-01-11 17:37 domain over enum problem Peter Eisentraut <peter_e@gmx.net>
2011-01-11 18:05 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox