domain type with create cast not working on pg15, but work on pg14

From: alias <postgres(dot)rocks(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: domain type with create cast not working on pg15, but work on pg14
Date: 2022-04-25 06:07:49
Message-ID: CAJA4AWTdyc15kVwHpEFG7u9FMVuExEQdAi9Mf9tCK778sKwToQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

seems like a bug, since PostgreSQL 15 - pgPedia - a PostgreSQL Encyclopedia
<https://pgpedia.info/postgresql-versions/postgresql-15.html> does not
mention anything about domain/cast changes.

the following code works on

> PostgreSQL 15devel (Ubuntu
> 15~~devel~20220407.0430-1~713.git79b716c.pgdg20.04+1) on
> x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0,
> 64-bit

---
create domain isodow as integer check(value between 1 and 7);
create function testcast(in a timestamptz ,out isodow)
as $$ select extract(dow from a ) $$ language sql;
CREATE CAST (timestamptz AS isodow) WITH FUNCTION testcast(timestamptz) AS
ASSIGNMENT;
----
then execute it:
select '2022-04-23 19:00:01 +5:30'::timestamptz::isodow;
return *6*
*---*
however when i run it PostgreSQL 14.2 (Ubuntu 14.2-1.pgdg20.04+1+b1) on
x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0,
64-bit

yield the following error:

> ERROR: 42846: cannot cast type timestamp with time zone to isodow
> LINE 1: select '2022-04-23 19:00:01 +5:30'::timestamptz::isodow;
> ^
> LOCATION: transformTypeCast, parse_expr.c:2652

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message 와따가따 2022-04-25 07:51:43 [issue] wal_buffers_full increases depending on the values of wal_buffers and wal-segsize
Previous Message Noah Misch 2022-04-25 05:22:55 Re: BUG #17401: REINDEX TABLE CONCURRENTLY creates a race condition on a streaming replica