Обсуждение: Re: problem insert time into column timestamp

Поиск
Список
Период
Сортировка

Re: problem insert time into column timestamp

От
"frank_lupo"
Дата:
> frank_lupo a écrit:
> > When working with Ingres, it is possible to create a field "date"
> > and insert into this a time value e.g. '10:12:12'
> > the current date is assigned automatically by Ingres
> > e.g. '31/07/2002 10:12:12'
> > 
> > When working with Postgres, I receive an error when trying to insert a
> > time value into a timestamp field
> > gedis30=# create table pippo (aa timestamp)\g
> > 
> > gedis30=# insert into pippo (aa) values('10:12:12')\g
> > ERROR:  Bad timestamp external representation '10:12:12'
> > 
> > How can I solve this problem ?
> gedis30=# insert into pippo (aa) values(cast ('10:12:12' as time));
 
Problem to execute insert command.
 
gedis30=# insert into pippo (aa) values(cast ('10:12:12' as time));
ERROR:  column "aa" is of type 'timestamp with time zone' but expression is of type 'time without time zone' 
        You will need to rewrite or cast the expression
 
 
Bye !! Frank Lupo (Wolf) !!

----
Prendi GRATIS l'email universale che... risparmia: clicca qui

Sponsor:
nuovissimo Sony Ericsson T68i marchiato TIM
Clicca qui

Re: problem insert time into column timestamp

От
Darren Ferguson
Дата:
You should specify in the table declaration

aa time without time zone

HTH

On Fri, 2 Aug 2002, [utf-8] frank_lupo wrote:

> > frank_lupo a écrit:
> > > When working with Ingres, it is possible to create a field "date"
> > > and insert into this a time value e.g. '10:12:12'
> > > the current date is assigned automatically by Ingres
> > > e.g. '31/07/2002 10:12:12'
> > >
> > > When working with Postgres, I receive an error when trying to insert a
> > > time value into a timestamp field
> > > gedis30=# create table pippo (aa timestamp)\g
> > >
> > > gedis30=# insert into pippo (aa) values('10:12:12')\g
> > > ERROR:  Bad timestamp external representation '10:12:12'
> > >
> > > How can I solve this problem ?
> >
> >
> > gedis30=# insert into pippo (aa) values(cast ('10:12:12' as time));
> >
> >
>
> Problem to execute insert command.
>
> gedis30=# insert into pippo (aa) values(cast ('10:12:12' as time));
> ERROR:  column "aa" is of type 'timestamp with time zone' but expression is of type 'time without time zone'
>         You will need to rewrite or cast the expression

Bye !!
Frank Lupo (Wolf) !!> frank_lupo a écrit:
> > > When working with Ingres, it is possible to create a field "date"
> > > and insert into this a time value e.g. '10:12:12'
> > > the current date is assigned automatically by Ing