Matching domains-over-enums to anyenum types

From: Ronan Dunklau <ronan(dot)dunklau(at)aiven(dot)io>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Matching domains-over-enums to anyenum types
Date: 2022-01-10 16:01:48
Message-ID: 2808697.e9J7NaK4W3@aivenronan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2022-01-10 17:00:00 Re: Why is src/test/modules/committs/t/002_standby.pl flaky?
Previous Message Andrew Dunstan 2022-01-10 15:57:00 Re: Windows crash / abort handling