Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id B05462E2D70 for ; Tue, 1 Jan 2008 15:33:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 92216-02 for ; Tue, 1 Jan 2008 15:33:25 -0400 (AST) Received: from proton.planetargon.com (proton.planetargon.com [198.145.115.11]) by postgresql.org (Postfix) with ESMTP id C6F872E2D6C for ; Tue, 1 Jan 2008 15:33:25 -0400 (AST) Received: by proton.planetargon.com (Postfix, from userid 502) id 43CB1834223; Tue, 1 Jan 2008 11:32:59 -0800 (PST) Received: from [10.0.1.200] (c-67-165-16-168.hsd1.ct.comcast.net [67.165.16.168]) by proton.planetargon.com (Postfix) with ESMTP id 11AFF83422B; Tue, 1 Jan 2008 11:32:37 -0800 (PST) In-Reply-To: <20080101142837.GA24772@apartia.fr> References: <7e7750290711070237x7da14616i383ace7f513f0882@mail.gmail.com> <16805.1194449708@sss.pgh.pa.us> <20080101142837.GA24772@apartia.fr> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-sql@postgresql.org Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: EPOCH TIMESTAMP Conversion Problem Date: Tue, 1 Jan 2008 14:32:25 -0500 To: Louis-David Mitterrand X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/7 X-Sequence-Number: 29861 On Jan 1, 2008, at 9:28 , Louis-David Mitterrand wrote: > On Wed, Nov 07, 2007 at 10:35:08AM -0500, Tom Lane wrote: >> "Amitanand Chikorde" writes: >>> I want to convert MAX(mydate) from myTable to Epoch. >> >> Do you mean >> SELECT EXTRACT(EPOCH FROM MAX(mydate)) FROM myTable > > Is using casts for the same purpose deprecated? > > SELECT current_date::timestamp::abstime::int4; EXTRACT is SQL-standard syntax which appeals to some people. The :: casting syntax is a Postgres extension. And from the docs: http://www.postgresql.org/docs/8.2/static/datatype-datetime.html > The types abstime and reltime are lower precision types which are > used internally. You are discouraged from using these types in new > applications and are encouraged to move any old ones over when > appropriate. Any or all of these internal types might disappear in > a future release. Michael Glaesemann grzm seespotcode net