Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 999232E2F28 for ; Fri, 25 Jan 2008 10:15:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 31221-05 for ; Fri, 25 Jan 2008 10:15:34 -0400 (AST) Received: from tomts5-srv.bellnexxia.net (tomts5.bellnexxia.net [209.226.175.25]) by postgresql.org (Postfix) with ESMTP id C8CF82E300E for ; Fri, 25 Jan 2008 10:15:34 -0400 (AST) Received: from toip7.srvr.bell.ca ([209.226.175.124]) by tomts5-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20080125141532.VMZO17217.tomts5-srv.bellnexxia.net@toip7.srvr.bell.ca> for ; Fri, 25 Jan 2008 09:15:32 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FACt+mUdBX6JU/2dsb2JhbACBV6x/ Received: from bas3-london14-1096786516.dsl.bell.ca (HELO t60p.bax.ca) ([65.95.162.84]) by toip7.srvr.bell.ca with ESMTP; 25 Jan 2008 09:17:02 -0500 Message-ID: <4799EF03.30203@sympatico.ca> Date: Fri, 25 Jan 2008 09:15:31 -0500 From: Frank Bax User-Agent: Thunderbird 2.0.0.6 (X11/20070818) MIME-Version: 1.0 To: iuri.sampaio@computer.org, pgsql-sql@postgresql.org Subject: Re: date format References: <1201162018.7883.12.camel@COMPAQ> In-Reply-To: <1201162018.7883.12.camel@COMPAQ> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/189 X-Sequence-Number: 30042 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