I have declarations in my schema for Postgres 12 database:
CREATE TYPE something_e AS ENUM('OPEN', 'CLOSE');
CREATE DOMAIN something_t AS something_e NOT NULL DEFAULT 'OPEN';
CREATE TABLE xxx (
...
something something_t,
...
);
And it seems that INSERTs work fine. But the select - does not:
INSERT INTO yyy (...) VALUES (..., (SELECT ID FROM xxx WHERE ... AND something='OPEN'));
And here I get an error:
"ERROR: operator does not exist: something_t = unknown".
I tried to cast a type to something_e, to something_t with :: but without any success. I even got an error like "operator does not exist: something_t = something_t" ! My initial idea was to reduce repeating of a code, so to introduce this something_t new domain based on the enum something_e, but how to select now using such a criteria? INSERT's seems cast 'OPEN' strings to something_t automatically... What is the right syntax for this case?