Getting error while trying to insert date with the format 'dd-month-yyyy' , 'day-mm-yyyy' etc..

From: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: hope(dot)jiang(at)enterprisedb(dot)com, ahsan(dot)hadi(at)enterprisedb(dot)com
Subject: Getting error while trying to insert date with the format 'dd-month-yyyy' , 'day-mm-yyyy' etc..
Date: 2009-06-10 08:18:50
Message-ID: 460abcb10906100118k6b3bdbb0o4cbc2ab5ea34d515@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Getting error while trying to insert date with the format 'dd-month-yyyy' ,
'day-mm-yyyy' (format which add the space in between the date ) etc..

Testcase:
========
postgres=# \d t
Table "public.t"
Column | Type | Modifiers
--------+------+-----------
a | date |

postgres=# insert into t values ( to_char(current_date+2,
'day-mm-yyyy')::date);
ERROR: invalid input syntax for type date: "friday -06-2009"

postgres=# insert into t values ( to_char(current_date+2,
'dd-month-yyyy')::date);
ERROR: invalid input syntax for type date: "12-june -2009"

Debugged the issue and found that error coming from date_in() ->
DecodeDateTime(). Problem here is whenever any space comes in the date
ParseDateTime() unable to break string into tokens based on a date/time
context.

--
Rushabh Lathia
www.EnterpriseDB.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2009-06-10 10:54:49 Re: Plan time Improvement - 64bit bitmapset
Previous Message Albe Laurenz 2009-06-10 07:38:18 Re: Problem with listen_addresses = '*' on 8.4beta2 on AIX