pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ask about epoch query with datetime
2+ messages / 2 participants
[nested] [flat]

* ask about epoch query with datetime
@ 2009-05-07 08:24 haries fajar nugroho <hariesfn@gmail.com>
  2009-05-07 08:47 ` Re: ask about epoch query with datetime Ian Barwick <barwick@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: haries fajar nugroho @ 2009-05-07 08:24 UTC (permalink / raw)
  To: pgsql-sql

Hi All,

my institution wants me to migrate from old postgresql to new
postgresql, but when i test one of the query it failed at query :
select date_part('epoch',datetime('2009-04-20
17:08:01')-datetime('2009-04-20 17:04:24'))::int;
that query runs well in previous postgresql (PostgreSQL 7.1.3). The
error message is ERROR:  function datetime("unknown") does not exist
HINT:  No function matches the given name and argument types. You may
need to add explicit type casts.

If i read the error message, it means the function has changed or
something. May  I know the latest function so my query can run well in
my PostgreSQL 8.1.11 ?

Thanks



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: ask about epoch query with datetime
  2009-05-07 08:24 ask about epoch query with datetime haries fajar nugroho <hariesfn@gmail.com>
@ 2009-05-07 08:47 ` Ian Barwick <barwick@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Ian Barwick @ 2009-05-07 08:47 UTC (permalink / raw)
  To: haries fajar nugroho <hariesfn@gmail.com>; +Cc: pgsql-sql

2009/5/7 haries fajar nugroho <hariesfn@gmail.com>:
> Hi All,
>
> my institution wants me to migrate from old postgresql to new
> postgresql, but when i test one of the query it failed at query :
> select date_part('epoch',datetime('2009-04-20
> 17:08:01')-datetime('2009-04-20 17:04:24'))::int;
> that query runs well in previous postgresql (PostgreSQL 7.1.3). The
> error message is ERROR:  function datetime("unknown") does not exist
> HINT:  No function matches the given name and argument types. You may
> need to add explicit type casts.
>
> If i read the error message, it means the function has changed or
> something. May  I know the latest function so my query can run well in
> my PostgreSQL 8.1.11 ?

Try something like:

select date_part('epoch','2009-04-20 17:08:01'::TIMESTAMP -
'2009-04-20 17:04:24'::TIMESTAMP)::int;


Ian Barwick



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2009-05-07 08:47 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-05-07 08:24 ask about epoch query with datetime haries fajar nugroho <hariesfn@gmail.com>
2009-05-07 08:47 ` Ian Barwick <barwick@gmail.com>

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