Re: What Am I Doing Wrong?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Lane Van Ingen <lvaningen(at)esncc(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: What Am I Doing Wrong?
Date: 2005-10-18 23:39:15
Message-ID: 20051018233914.GA44288@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Oct 18, 2005 at 03:38:54PM -0400, Lane Van Ingen wrote:
> select EXTRACT(EPOCH from TIMESTAMP current_timestamp) - EXTRACT(EPOCH from
> TIMESTAMP updated_time) ::integer
>
> ERROR: syntax error at or near "current_timestamp" at character 37

What are you intending "TIMESTAMP" to do? If you're trying to do
a cast then see "Type Casts" in the documentation for the correct
syntax:

http://www.postgresql.org/docs/8.0/interactive/sql-expressions.html#SQL-SYNTAX-TYPE-CASTS

You might not need a cast at all:

test=> SELECT extract(epoch FROM current_timestamp);
date_part
------------------
1129678734.81522
(1 row)

--
Michael Fuhr

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2005-10-18 23:40:12 Re: Query information needed
Previous Message Stewart Ben (RBAU/EQS4) * 2005-10-18 23:13:46 Re: Problem while using start transaction ans commit;