iuri de araujo sampaio wrote:
hi,

how to change the default format for type date?
I have created a field on a table:

##
create table tbl_inventory (
        item_id integer constraint c_pk primary key,
     I.         purchase_date date,
    II.         fabrication_date date,
   III.         expiration_date date
);
##

the error i got is:
##
Database operation "dml" failed
(exception ERROR, "ERROR:  invalid input syntax for type date: "2008 7 22 {} {} {} 
{DD MONTH YYYY}"
")
##


Assuming that your import code has something similar to:

insert into tbl_inventory(item_id,purchase_date)
        values(1,"2008 7 22 {} {} {} {DD MONTH YYYY}")

I would change it to something like:

insert into tbl_inventory(item_id,purchase_date)
values(1,regexp_replace('2008 7 22 {} {} {} {DD MONTH YYYY}','{.+} *','','g')::date);

Frank

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org

Reply via email to