Re: implement CAST(expr AS type FORMAT 'template')

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Haibo Yan <tristan(dot)yim(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, Vik Fearing <vik(at)postgresfriends(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: implement CAST(expr AS type FORMAT 'template')
Date: 2026-07-02 21:16:52
Message-ID: CA+TgmobibgO2a3UDr7DrbKVnDG9ZViYTn6+nKR3Kq88Aii7-fw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 2, 2026 at 4:51 PM David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirill Reshke 2026-07-02 21:20:08 GIN amcheck leaks memory in gin_check_parent_keys_consistency
Previous Message David G. Johnston 2026-07-02 20:51:13 Re: implement CAST(expr AS type FORMAT 'template')