From: Ian Barwick <barwick@gmail.com>
To: haries fajar nugroho <hariesfn@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: ask about epoch query with datetime
Date: Thu, 7 May 2009 17:47:03 +0900
Message-ID: <1d581afe0905070147x7a1fd526k75eb6bb683cf930d@mail.gmail.com> (raw)
In-Reply-To: <bf3435570905070124t3b97baachd6c6eab41da68c08@mail.gmail.com>
References: <bf3435570905070124t3b97baachd6c6eab41da68c08@mail.gmail.com>
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
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: barwick@gmail.com, hariesfn@gmail.com
Subject: Re: ask about epoch query with datetime
In-Reply-To: <1d581afe0905070147x7a1fd526k75eb6bb683cf930d@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