public inbox for [email protected]
help / color / mirror / Atom feedFrom: Vik Fearing <[email protected]>
To: David G. Johnston <[email protected]>
To: Corey Huinker <[email protected]>
Cc: jian he <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: implement CAST(expr AS type FORMAT 'template')
Date: Mon, 4 Aug 2025 14:57:47 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKFQuwYrwM64YnvZ5aL1DEWG50uW-1SrXesSKkmvpxXXrxTW-g@mail.gmail.com>
References: <CACJufxGqm7cYQ5C65Eoh1z-f+aMdhv9_7V=NoLH_p6uuyesi6A@mail.gmail.com>
<[email protected]>
<CACJufxF4OW=x2rCwa+ZmcgopDwGKDXha09qTfTpCj3QSTG6Y9Q@mail.gmail.com>
<[email protected]>
<CACJufxEH-8UPdbPoUoqNRaiOePw+s2W2DG4OpXtoSYDaW30oAg@mail.gmail.com>
<CAKFQuwZXYxPw4wofq+zZ5D7nH0sHDBwr--qku9jWYv7dS+P8RQ@mail.gmail.com>
<CACJufxGTeSnHn7w8r-qoQrqwCFQSC+CbiEthzpHKUd+bPr_0mA@mail.gmail.com>
<[email protected]>
<CACJufxGbsc3g6RZf0rZpKYxffK6vGkc_OsTmX54uS0kFcVBtvA@mail.gmail.com>
<CAKFQuwaG00tsXc2oSQwjdSnPQ=JuH+T8Oeejb3sO5TeqUHsfUQ@mail.gmail.com>
<CADkLM=cvhJBrCj3GV+jXfpb5+U1Z33nsvCXo-=ZkDyaSPbS-1g@mail.gmail.com>
<CAKFQuwYrwM64YnvZ5aL1DEWG50uW-1SrXesSKkmvpxXXrxTW-g@mail.gmail.com>
On 04/08/2025 07:55, David G. Johnston wrote:
> On Sunday, August 3, 2025, Corey Huinker <[email protected]> wrote:
>
> On Sun, Aug 3, 2025 at 11:36 PM David G. Johnston
> <[email protected]> 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
view thread (53+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: implement CAST(expr AS type FORMAT 'template')
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox