Re: Bug on version 12 ? - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Bug on version 12 ?
Date
Msg-id 3aaf334b-9efe-f9ba-786c-b5137ab606b9@aklaver.com
Whole thread Raw
In response to Re: Bug on version 12 ?  (PegoraroF10 <marcos@f10.com.br>)
List 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.klaver@aklaver.com



pgsql-general by date:

Previous
From: "Ravi Krishna"
Date:
Subject: Re: Inherited an 18TB DB & need to backup
Next
From: Tom Lane
Date:
Subject: Re: Bug on version 12 ?