Re: Bug on version 12 ?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: PegoraroF10 <marcos(at)f10(dot)com(dot)br>, pgsql-general(at)postgresql(dot)org
Subject: Re: Bug on version 12 ?
Date: 2020-05-15 17:55:25
Message-ID: 3aaf334b-9efe-f9ba-786c-b5137ab606b9@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 5/15/20 9:38 AM, PegoraroF10 wrote:
> Ok Tom but then you cannot go back and forth, like this ...
>
> select to_timestamp(jsonb_build_object('mydate',
> current_timestamp)->>'mydate', 'YYYY-MM-DD HH24:MI:SS');

select jsonb_build_object('mydate',
current_timestamp);
jsonb_build_object
------------------------------------------------
{"mydate": "2020-05-15T10:54:17.913596-07:00"}
(1 row)

Option 1:

select to_timestamp(jsonb_build_object('mydate',
current_timestamp)->>'mydate', 'YYYY-MM-DD T HH24:MI:SS');
to_timestamp
-------------------------
05/15/2020 10:54:20 PDT

Option 2 per Tom's suggestion:

select (jsonb_build_object('mydate',
current_timestamp)->>'mydate')::timestamptz;
timestamptz
--------------------------------
05/15/2020 10:54:58.649859 PDT

>
> works on 11.7 but not on 12.3.
>
>
>
>
>
> --
> Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2020-05-15 18:34:07 Re: Bug on version 12 ?
Previous Message Ravi Krishna 2020-05-15 17:51:37 Re: Inherited an 18TB DB & need to backup