pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Shoaib Mir <shoaibmir@gmail.com>
To: Richard Huxton <dev@archonet.com>
Cc: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Insert into a date field
Date: Fri, 2 Feb 2007 18:45:16 +0500
Message-ID: <bf54be870702020545p1d755059g2f6a5d2cbb78ab59@mail.gmail.com> (raw)
In-Reply-To: <45C338BD.8000406@archonet.com>
References: <55c095e90702020508o70a561ffl8306739f311b8807@mail.gmail.com>
	<45C338BD.8000406@archonet.com>

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
>

view thread (5+ messages)  latest in thread

Message-ID: <bf54be870702020545p1d755059g2f6a5d2cbb78ab59@mail.gmail.com>
Permalink:  ../bf54be870702020545p1d755059g2f6a5d2cbb78ab59@mail.gmail.com/
Also on:    postgresql.org/message-id/bf54be870702020545p1d755059g2f6a5d2cbb78ab59@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: shoaibmir@gmail.com, dev@archonet.com, ezequias.rocha@gmail.com
  Subject: Re: Insert into a date field
  In-Reply-To: <bf54be870702020545p1d755059g2f6a5d2cbb78ab59@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox