public inbox for [email protected]  
help / color / mirror / Atom feed
From: Corey Huinker <[email protected]>
To: jian he <[email protected]>
Cc: Amul Sul <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: Kirill Reshke <[email protected]>
Cc: Vik Fearing <[email protected]>
Cc: Isaac Morland <[email protected]>
Cc: [email protected]
Subject: Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions
Date: Wed, 1 Apr 2026 16:07:49 -0400
Message-ID: <CADkLM=c_QQkpBhm0HfGm5C8gOFNKW6g5E=W5Jp9mjayUW3yXYQ@mail.gmail.com> (raw)
In-Reply-To: <CACJufxGRSV3j6g7feEkfu7WuLx7ocMte8mvVEwNh7XBfnpJd-A@mail.gmail.com>
References: <CADkLM=fv1JfY4Ufa-jcwwNbjQixNViskQ8jZu3Tz_p656i_4hQ@mail.gmail.com>
	<CADkLM=cZ7N+f4Bj-8MiccFcTASjBB2r1_s3BD9OFbbQOwK01cg@mail.gmail.com>
	<CACJufxE7yoH42juViFvYuCQMPwXMWxDVwiugs-BW+N4oUXB=1w@mail.gmail.com>
	<CADkLM=dFZ8-mBJDkiZZ4JadnJy8zLExUoo_b1FOs2Ozrtge=gQ@mail.gmail.com>
	<CACJufxHynx40aHHUCR4wZh1qnL=X0yw6baW4Z-+vkUgT0OhjOg@mail.gmail.com>
	<CADkLM=eCPiVhGKcbNW5bUEYpozUaKNXjd_UmBVR256p2zWtYQQ@mail.gmail.com>
	<CACJufxH4LrCpL63SRYO3zVk46YdD4--VYQoBL7GmHmCm=NCAJQ@mail.gmail.com>
	<CADkLM=cmv_bmxBe8KmZd6rEgiqSdoDfHnJa63u7rdRuAsqOwDA@mail.gmail.com>
	<CACJufxGbw9iNT8QVm4QD9cPFKnDnvDBQp7AGxkoqDa-JjzVXmg@mail.gmail.com>
	<CACJufxFkLLuX1VJ-J3fppCr37PHtxkvwyd_e4zNd+VYK0v0gnQ@mail.gmail.com>
	<[email protected]>
	<CACJufxHx-UfprE6P4_ZB_cOYktHd4pLMNx=jWJFOGGGFj2YZWQ@mail.gmail.com>
	<CACJufxH_1EtEBMb0JvxaM3Gmnt33HYrS37m5eYjJ_OfBkMVFJg@mail.gmail.com>
	<CACJufxHGox47X4zNtVeNw7H=SZ7ATAAD5SEYpvxa2o5mPV0XCA@mail.gmail.com>
	<[email protected]>
	<CAAJ_b959dfJsorK+_vPdVa8F3QYPdOnb-HzJY8oQQR91N9Tq2A@mail.gmail.com>
	<CACJufxFOQkmH9KeQNTD0qASbL3i03cLeoyVZdcZ8Fm0rk6eJ5Q@mail.gmail.com>
	<CACJufxEUr33CoQMsZdEehNU7wj_QOiyk8VW=W+aB03PF2J_qKQ@mail.gmail.com>
	<CACJufxGx_XDHq1btNj=ZrBjwd0skeWFJQLMGqSR-pHw-kuYRnQ@mail.gmail.com>
	<CADkLM=cXsprF2GvcmqOG+ME_N2iyHNr_--xW-6ZaKd32yF_NzA@mail.gmail.com>
	<CACJufxGRSV3j6g7feEkfu7WuLx7ocMte8mvVEwNh7XBfnpJd-A@mail.gmail.com>

On Wed, Apr 1, 2026 at 3:23 AM jian he <[email protected]> wrote:

> One more issue I found:
>
> https://git.postgresql.org/cgit/postgresql.git/commit/?id=74c96699be3f53c058c8794c07952221b9625b4f
> SELECT JSON_VALUE(jsonb '1234', '$' RETURNING char(2)  DEFAULT '011' ON
> ERROR);
> ERROR:  value too long for type character(2)
>
> Similarly, we can
> SELECT CAST(text '1234' as char(2) DEFAULT '111111' ON conversion ERROR);
> ERROR:  value too long for type character(2)
>

Both of these are doomed when we hit the default, so I don't see why we
should make any accommodation for them.



> Composite types respect typmod, for example:
> CREATE TYPE comp AS (a char(3), b int);
> SELECT CAST('(14,42)' AS comp DEFAULT '(1234,2)' ON CONVERSION ERROR); --
> error
>

This one is trickier, but I'd be willing to reject composite inputs in v19
and solve it in v20.


> The regression tests are too large; we can order them by the cast
> source type's pg_type.type category,
> so we won't miss any tests.
>

We can always remove redundant tests later.


view thread (67+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions
  In-Reply-To: <CADkLM=c_QQkpBhm0HfGm5C8gOFNKW6g5E=W5Jp9mjayUW3yXYQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox