Timestamp parsing with blanked time part

From: Ireneusz Pluta <ipluta(at)wp(dot)pl>
To: pgsql-general(at)postgresql(dot)org
Subject: Timestamp parsing with blanked time part
Date: 2011-07-22 08:59:23
Message-ID: 4E293BEB.3070505@wp.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

consider the following:

select quote_literal(blank_hms) as "quote_literal(blank_hms)", blank_hms::timestamp as
"blank_hms::timestamp" from (select unnest(array['2011-07-22 :', '2011-07-22 : ', '2011-07-22 : :
']::text[]) as blank_hms) a; select version();

quote_literal(blank_hms) | blank_hms::timestamp
--------------------------+----------------------
'2011-07-22 :' | 2011-07-22 00:00:00
'2011-07-22 : ' | 2011-07-22 00:00:00
'2011-07-22 : : ' | 2011-07-22 00:00:00
(3 rows)

Time: 0.264 ms
version
------------------------------------------------------------------------------------------------------------------
PostgreSQL 9.0.3 on x86_64-manual_install-freebsd8.x, compiled by GCC cc (GCC) 4.2.1 20070719
[FreeBSD], 64-bit
(1 row)

The result is what might be expected by the common sense means.

Howewer, the input format of the example datetime strings is definitely wrong as far as I guess.
Some other datetime parsers reject it, the Perl DateTime::Format::Pg is an example.

Is this case a subject of eventual corrections in the future versions of postgres and it would start
emit errors then?

Thanks
Irek.

Browse pgsql-general by date

  From Date Subject
Next Message Ireneusz Pluta 2011-07-22 08:59:36 Timestamp parsing with blanked time part
Previous Message Harshitha S 2011-07-22 08:43:41 Tracing in Postgres