Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id C22749FB1BA for ; Fri, 2 Feb 2007 09:45:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 95581-01 for ; Fri, 2 Feb 2007 09:45:18 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.228]) by postgresql.org (Postfix) with ESMTP id 2F44C9FB255 for ; Fri, 2 Feb 2007 09:45:18 -0400 (AST) Received: by nz-out-0506.google.com with SMTP id i11so829722nzh for ; Fri, 02 Feb 2007 05:45:16 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=hUMEcX9IlqEPSkiCsPlxSyh0Mtkw8O/Lu/3p7EhgIketkB9spHTuezsX3l4Ek+n+w6gQtDnYIW2r+HGeh2JitXgLJtzHPo07bgvOkpfCq/MkpbIEJgVDpIfZWMaD4bhTpBHUEMbSFYqkmvoro8HaUTTT309DpvUF6JO5X/SY8yI= Received: by 10.65.241.20 with SMTP id t20mr6030467qbr.1170423916522; Fri, 02 Feb 2007 05:45:16 -0800 (PST) Received: by 10.65.206.17 with HTTP; Fri, 2 Feb 2007 05:45:16 -0800 (PST) Message-ID: Date: Fri, 2 Feb 2007 18:45:16 +0500 From: "Shoaib Mir" To: "Richard Huxton" Subject: Re: Insert into a date field Cc: "Ezequias Rodrigues da Rocha" , pgsql-sql@postgresql.org In-Reply-To: <45C338BD.8000406@archonet.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_15597_9088811.1170423916358" References: <55c095e90702020508o70a561ffl8306739f311b8807@mail.gmail.com> <45C338BD.8000406@archonet.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/9 X-Sequence-Number: 27343 ------=_Part_15597_9088811.1170423916358 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Just tried the following way, that might help you: postgres=# create table testing (a date); CREATE TABLE postgres=# insert into testing values (to_date('1963-09-01', 'YYYY-MM-DD')); INSERT 0 1 postgres=# select * from testing; a ------------ 1963-09-01 (1 row) -- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 2/2/07, Richard Huxton wrote: > > Ezequias Rodrigues da Rocha wrote: > > Hi list, > > > > I am trying to insert a record in a table with a date field but the > > postgresql reports me the following error: > > > > ERROR: column "data_nascimento" is of type date but expression is of > type > > integer > > SQL state: 42804 > > Hint: You will need to rewrite or cast the expression. > > > > > > I tryed like this: > > > > > > '1963-09-01' > > '1963-09-01'::date > > 1963-09-01 > > Show us the whole statement - this doesn't look like the error to me. > > -- > Richard Huxton > Archonet Ltd > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > ------=_Part_15597_9088811.1170423916358 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Just tried the following way, that might help you:

postgres=# create table testing (a date);
CREATE TABLE
postgres=# insert into testing values (to_date('1963-09-01', 'YYYY-MM-DD'));
INSERT 0 1
postgres=# select * from testing;
     a
------------
 1963-09-01
(1 row)

--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 2/2/07, Richard Huxton <dev@archonet.com> wrote:
Ezequias Rodrigues da Rocha wrote:
> Hi list,
>
> I am trying to insert a record in a table with a date field but the
> postgresql reports me the following error:
>
> ERROR: column "data_nascimento" is of type date but expression is of type
> integer
> SQL state: 42804
> Hint: You will need to rewrite or cast the expression.
>
>
> I tryed like this:
>
>
> '1963-09-01'
> '1963-09-01'::date
> 1963-09-01

Show us the whole statement - this doesn't look like the error to me.

--
   Richard Huxton
   Archonet Ltd

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

               http://archives.postgresql.org

------=_Part_15597_9088811.1170423916358--