| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
| Cc: | Vik Fearing <vik(at)postgresfriends(dot)org>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: implement CAST(expr AS type FORMAT 'template') |
| Date: | 2026-03-30 08:09:24 |
| Message-ID: | CACJufxFVMYuVz63DteEjbMdvx2neoYcwSRb5vhO-03Tzx=B8Jw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Mar 24, 2026 at 2:31 PM Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> wrote:
> Hello!
>
> There's some inconsistency in deparse, it displays to_char for intervals:
>
> I also see a similar to_char leak in the error message - wouldn't this
> confuse users, as they never wrote to_char?
>
> postgres=# SELECT cast('2012-12-12 12:00'::timetz as text format
> 'YYYY-MM-DD HH:MI:SS TZ');
> ERROR: function pg_catalog.to_char(time with time zone, text) does not exist
> DETAIL: No function of that name accepts the given argument types.
> HINT: You might need to add explicit type casts.
The nearby v6 fixed these two issues, but,
src1=# SELECT cast('2012-12-12 12:00'::timetz as text format
'YYYY-MM-DD HH:MI:SS TZ');
ERROR: cannot cast type time with time zone to text using formatted template
LINE 1: SELECT cast('2012-12-12 12:00'::timetz as text format
^
DETAIL: Only categories of numeric, string, datetime, and timespan
source data types are supported for formatted type casting
The errdeatil above is not good and needs further improvement, since
timetz is a datetime category data type.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Zhijie Hou (Fujitsu) | 2026-03-30 08:14:07 | RE: Bug: wrong relname in RemoveSubscriptionRel() error detail |
| Previous Message | jian he | 2026-03-30 08:07:51 | Re: implement CAST(expr AS type FORMAT 'template') |