| From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
|---|---|
| To: | Haibo Yan <tristan(dot)yim(at)gmail(dot)com> |
| Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, Vik Fearing <vik(at)postgresfriends(dot)org>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: implement CAST(expr AS type FORMAT 'template') |
| Date: | 2026-07-06 20:27:41 |
| Message-ID: | CA+TgmoaBtMU5d0zFOiRxK1ue2B-HFdUz4cq9Rq1rJ2zx8OEd4w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Jul 6, 2026 at 4:15 PM Haibo Yan <tristan(dot)yim(at)gmail(dot)com> wrote:
> The examples I listed are mostly conversions between a typed value and a
> textual or binary representation, not arbitrary conversions between unrelated
> types. So I agree that the current pg_format_cast design may be too broad if
> it allows arbitrary source/target pairs.
Well, I don't think the issue here is really about pg_format_cast. If
the syntax supports arbitrary pairs of types, the catalog
representation should do. But there's also the question of whether we
want to support the syntax.
> Maybe the better boundary is that a formatted conversion should be between a
> data type and an external representation type, probably text or bytea.
>
> That would allow cases such as text -> date, numeric -> text, and
> bytea -> some_type, and also the existing-style text <-> bytea encoding
> case. But it should not become a generic text -> text or bytea -> bytea
> transformation mechanism, nor a second cast system for arbitrary type pairs.
But if this is in the SQL standard -- is it? -- then that ship has
already sailed. We're just left to wonder why they did it like that...
--
Robert Haas
EDB: http://www.enterprisedb.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Noah Misch | 2026-07-06 20:29:42 | Re: wait_event_type for WAIT FOR LSN |
| Previous Message | Haibo Yan | 2026-07-06 20:15:28 | Re: implement CAST(expr AS type FORMAT 'template') |