Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 9FA0C635074 for ; Thu, 7 May 2009 05:47:52 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 71580-05 for ; Thu, 7 May 2009 05:47:51 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.30]) by mail.postgresql.org (Postfix) with ESMTP id DE15963505D for ; Thu, 7 May 2009 05:47:03 -0300 (ADT) Received: by yx-out-2324.google.com with SMTP id 8so373912yxg.73 for ; Thu, 07 May 2009 01:47:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=2NGY3Z5o3puNdouI6/mcm3l6IHm40s+vv+7x/u0Y/Gc=; b=Z21x7P9l0rVRl9opFX154gqvj16WGeaHFrc5niPcTxsb7B50qMYeaG6FiJEoKpePes nD1W27qfmvdTqR6LvlqehYXXeh6ZhQtpz0gQe6CxSL46gvBhCsi1j4mTLR/wIYwnu8Ls WjB675C7ZtCxdNuSCufTneEekfuW7xc+08ROQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=GaU14S+gwQvc9azjrSWcricFinfcjK8YMsTEflO/H6tng6alrXt+NVyezmiOxKsPlg 7xD8qPAJOrn19gD9gg19srOFb14R/QUzTEWchaF0HTfp6t3D/clivm4RWwA1ArkccW8h MnofpYAehdmAGQSY9G095sWwGcZU7MNDHQZCs= MIME-Version: 1.0 Received: by 10.90.93.8 with SMTP id q8mr1662023agb.79.1241686023071; Thu, 07 May 2009 01:47:03 -0700 (PDT) In-Reply-To: References: Date: Thu, 7 May 2009 17:47:03 +0900 Message-ID: <1d581afe0905070147x7a1fd526k75eb6bb683cf930d@mail.gmail.com> Subject: Re: ask about epoch query with datetime From: Ian Barwick To: haries fajar nugroho Cc: pgsql-sql@postgresql.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200905/15 X-Sequence-Number: 32507 2009/5/7 haries fajar nugroho : > 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: =C2=A0function datetime("unknown") does not exist > HINT: =C2=A0No function matches the given name and argument types. You ma= y > need to add explicit type casts. > > If i read the error message, it means the function has changed or > something. May =C2=A0I 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