pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: nguyenkhacchinh@hotmail.com
Subject: BUG #17305: to_timestamp accept dates rejected by timestamptz cast
Date: Wed, 01 Dec 2021 13:59:30 +0000
Message-ID: <17305-f46fefde8303adf0@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17305
Logged by:          Chinh Nguyen
Email address:      nguyenkhacchinh@hotmail.com
PostgreSQL version: 10.19
Operating system:   Linux
Description:        

I don't know if this is a bug or just an unusual behavior. I had assumed,
per the documentation, that function to_timestamp() is the same as
timestamptz but with control for different formats.

The following dates are all rejected by timestamptz (e.g., select
'0000-01-01T00:00:01Z'::timestamptz):
0000-01-01T00:00:01Z, 0000-02-29T00:00:01Z, 0000-02-30T00:00:01Z,
0000-02-31T00:00:01Z

But they are accepted by to_timestamp (e.g., select to_timestamp('0000-01-01
00:00:00+00','YYYY-MM-DDThh24:mi:ssZ')). The results from to_timestamp
are:
0001-01-01 00:00:00+00 BC, 0001-02-29 00:00:00+00 BC, 0001-03-01 00:00:00+00
BC, 0001-03-02 00:00:00+00 BC

My version is 10.19 but I also tested against an online test db running
11.10.



view thread (3+ messages)  latest in thread

Message-ID: <17305-f46fefde8303adf0@postgresql.org>
Permalink:  ../17305-f46fefde8303adf0@postgresql.org/
Also on:    postgresql.org/message-id/17305-f46fefde8303adf0@postgresql.org

 · 

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: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, nguyenkhacchinh@hotmail.com
  Subject: Re: BUG #17305: to_timestamp accept dates rejected by timestamptz cast
  In-Reply-To: <17305-f46fefde8303adf0@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox