Matching domains-over-enums to anyenum types - Mailing list pgsql-hackers

From Ronan Dunklau
Subject Matching domains-over-enums to anyenum types
Date
Msg-id 2808697.e9J7NaK4W3@aivenronan
Whole thread Raw
Responses Re: Matching domains-over-enums to anyenum types
List pgsql-hackers
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:


https://www.postgresql.org/message-id/flat/BANLkTi%3DaGxDbGPSF043V2K-C2vF2YzGz9w%40mail.gmail.com#da4826d2cbbaca20e3440aadb3093158

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





pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Windows crash / abort handling
Next
From: Alexander Lakhin
Date:
Subject: Re: Why is src/test/modules/committs/t/002_standby.pl flaky?