Matching domains-over-enums to anyenum types

Started by Ronan Dunklauabout 4 years ago2 messages
#1Ronan Dunklau
ronan.dunklau@aiven.io

Hello,

A colleague of mine was surprised to discover the following statements raised
an error:

postgres=# CREATE TYPE abc_enum AS ENUM ('a', 'b', 'c');
CREATE TYPE
postgres=# CREATE DOMAIN abc_domain AS abc_enum;
CREATE DOMAIN
postgres=# SELECT 'a'::abc_domain = 'a'::abc_domain;
ERROR: operator does not exist: abc_domain = abc_domain
LINE 1: SELECT 'a'::abc_domain = 'a'::abc_domain;
^
HINT: No operator matches the given name and argument types. You might need
to add explicit type casts.

This has been already discussed a long time ago, and the idea was rejected at
the time since there was no demand for it:

/messages/by-id/BANLkTi=aGxDbGPSF043V2K-C2vF2YzGz9w@mail.gmail.com

Given that we implemented that behaviour for domains over ranges and
multiranges, I don't see the harm in doing the same for domains over enums.

What do you think ?

--
Ronan Dunklau

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ronan Dunklau (#1)
Re: Matching domains-over-enums to anyenum types

Ronan Dunklau <ronan.dunklau@aiven.io> writes:

This has been already discussed a long time ago, and the idea was rejected at
the time since there was no demand for it:
/messages/by-id/BANLkTi=aGxDbGPSF043V2K-C2vF2YzGz9w@mail.gmail.com

I see that one of the considerations in that thread was the lack
of arrays over domains. We've since fixed that, so probably it'd
be reasonable to take a fresh look, but I'm not sure that the
conclusion would be the same as what I proposed then.

regards, tom lane