Re: implement CAST(expr AS type FORMAT 'template') - Mailing list pgsql-hackers

From Robert Haas
Subject Re: implement CAST(expr AS type FORMAT 'template')
Date
Msg-id CA+TgmobibgO2a3UDr7DrbKVnDG9ZViYTn6+nKR3Kq88Aii7-fw@mail.gmail.com
Whole thread
In response to Re: implement CAST(expr AS type FORMAT 'template')  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: implement CAST(expr AS type FORMAT 'template')
List pgsql-hackers
On Thu, Jul 2, 2026 at 4:51 PM David G. Johnston
<david.g.johnston@gmail.com> wrote:
>> and the existence of a
>> format cast doesn't mean there has to be a regular cast.
>
> Disagree

OK, but on what basis?

If I want 'whatever'::thistype::thattype to fail and CAST(thistype AS
thattype FORMAT 'bumble') to succeed, then I need there to be a format
cast but not a regular cast. Apparently, you'd like to arbitrarily
disallow that case, but I can't see any logical reason for such a
prohibition. Essentially we'd be forcing the user to create a regular
cast that they don't want in order to be able to create a format cast
that they do want. If there were some reason why we had to couple the
two things together that way, that would be one thing, but as far as I
can see, there isn't.

--
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: implement CAST(expr AS type FORMAT 'template')
Next
From: Kirill Reshke
Date:
Subject: GIN amcheck leaks memory in gin_check_parent_keys_consistency