From: | Vik Fearing <vik(at)postgresfriends(dot)org> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: implement CAST(expr AS type FORMAT 'template') |
Date: | 2025-08-04 12:57:47 |
Message-ID: | 82b4223e-84d4-432d-8167-dd698ce489f5@postgresfriends.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 04/08/2025 07:55, David G. Johnston wrote:
> On Sunday, August 3, 2025, Corey Huinker <corey(dot)huinker(at)gmail(dot)com> wrote:
>
> On Sun, Aug 3, 2025 at 11:36 PM David G. Johnston
> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
>
> I was under the impression that for format to be allowed in
> the expression one of the two data types involved has to be
> text and the other must not be text.
>
>
> I hadn't understood that, but also hadn't thought of a case where
> it might be wanted until just now. What if someone wanted a cast
> from JSONB to their custom type, and the format was a specific
> keypath to extract from the JSONB? It's true that could be
> accomplished by first extracting the keypath and then CASTing that
> expression, but the same is true for text->date, regexing a
> YYYY-MM-DD into the locale default.
>
>
> Feels like the same basic answer. Create cast has a single (because
> it’s one-way) function accepting between 1 and 3 arguments. Change it
> to accept between 1 and 4 arguments and the 4th is where the format
> expression gets passed. If a format expression is present and the
> function doesn’t have a 4th argument, error.
This is my position as well.
+1
--
Vik Fearing
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2025-08-04 13:09:47 | Re: split func.sgml to separated individual sgml files |
Previous Message | Andrew Dunstan | 2025-08-04 12:33:00 | Re: GB18030-2022 Support in PostgreSQL |