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

From Haibo Yan
Subject Re: implement CAST(expr AS type FORMAT 'template')
Date
Msg-id CABXr29HF+AHV0FNxQfHyN-ByW6-3+pTBe5Pxm23wRpBYOmfohA@mail.gmail.com
Whole thread
In response to Re: implement CAST(expr AS type FORMAT 'template')  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: implement CAST(expr AS type FORMAT 'template')
List pgsql-hackers
On Mon, Jun 29, 2026 at 11:14 AM Robert Haas <robertmhaas@gmail.com> wrote:
>
> On Mon, Jun 29, 2026 at 1:20 AM Haibo Yan <tristan.yim@gmail.com> wrote:
> > I have attached the full patch series for review.  Comments are welcome.
>
> This looks good!
>
> I haven't done a detailed review, but I skimmed over all of the
> patches and I like the direction. I think we should consider calling
> it a "format cast" instead of a "formatter". It would avoid needing to
> make "formatter" a parser keyword.
>
> --
> Robert Haas
> EDB: http://www.enterprisedb.com

Hi Robert,

Thanks for looking at the patches.
I liked your suggestion to call these “format casts” rather than
“formatters”, so I changed the series in that direction.  The DDL is
now:
------------------------------------------------------
CREATE FORMAT CAST (...)
DROP FORMAT CAST (...)
------------------------------------------------------
rather than CREATE/DROP FORMATTER, so the patch no longer adds
FORMATTER as a keyword.
I also renamed the related catalog and node names, so this now uses
pg_format_cast and CoerceViaFormatCast.  The
pg_dump/object-address/comment/extension code and the regression tests
have been updated to use the new terminology as well.
The rest of the design is the same as before: format casts are still
catalog-driven, and both built-in and user-defined cases go through
the same lookup path.

Attached is the updated v2 series.

Regards,
Haibo

Attachment

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Fix race condition in pg_get_publication_tables with concurrent DROP TABLE
Next
From: Masahiko Sawada
Date:
Subject: Re: Optimize UUID parse using SIMD