New to_timestamp implementation is pretty strict

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: New to_timestamp implementation is pretty strict
Date: 2008-12-01 12:08:07
Message-ID: 4933D3A7.702@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I like strict in general, but this doesn't seem logical:

postgres=# SELECT to_timestamp('29-12-2005 01:2:03', 'DD-MM-YYYY
HH24:MI:SS'); -- works
to_timestamp
------------------------
2005-12-29 01:02:03+02
(1 row)

postgres=# SELECT to_timestamp('29-12-2005 01:02:3', 'DD-MM-YYYY
HH24:MI:SS'); -- doesn't work
ERROR: source string too short for "SS" formatting field
DETAIL: Field requires 2 characters, but only 1 remain.
HINT: If your source string is not fixed-width, try using the "FM"
modifier.

I think the end of string should be treated like a field separator,
colon in this example, and we should accept both of the above. Opinions?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2008-12-01 13:40:09 Re: WIP: default values for function parameters
Previous Message Simon Riggs 2008-12-01 11:42:20 Sync Rep: First Thoughts on Code