Skip site navigation (1) Skip section navigation (2)

Re: cross-database time extract?

From: Adrian Klaver <aklaver(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: Israel Brewster <israel(at)frontierflying(dot)com>
Subject: Re: cross-database time extract?
Date: 2009-12-24 21:56:27
Message-ID: 200912241356.27948.aklaver@comcast.net (view raw or flat)
Thread:
Lists: pgsql-general
On Thursday 24 December 2009 1:44:58 pm Israel Brewster wrote:
> This is sort of a PostgreSQL question/sort of a general SQL question,
> so I apologize if this isn't the best place to ask. At any rate, I
> know in PostgreSQL you can issue a command like 'SELECT
> "time"(timestamp_column) from table_name' to get the time part of a
> timestamp. The problem is that this command for some reason requires
> quotes around the "time" function name, which breaks the command when
> used in SQLite (I don't know about MySQL yet, but I suspect the same
> would be true there). The program I am working on is designed to work
> with all three types of databases (SQLite, PostgreSQL, and MySQL) so
> it would be nice (save me some programing) if there was a single SQL
> statement to get the time portion of a timestamp that would work with
> all three. Is there such a beast? On a related note, why do we need
> the quotes around "time" for the function to work in PostgreSQL? the
> date function doesn't need them, so I know it's not just a general
> PostgreSQL formating difference. Thanks :)
> -----------------------------------------------
> Israel Brewster
> Computer Support Technician II
> Frontier Flying Service Inc.
> 5245 Airport Industrial Rd
> Fairbanks, AK 99709
> (907) 450-7250 x293
> -----------------------------------------------

As to the "time" issue see here;
http://www.postgresql.org/docs/8.4/interactive/sql-expressions.html
4.2.9. Type Casts

-- 
Adrian Klaver
aklaver(at)comcast(dot)net

In response to

pgsql-general by date

Next:From: Scott MarloweDate: 2009-12-24 22:53:26
Subject: Re: Optimizing data layout for reporting in postgres
Previous:From: Raul GiucichDate: 2009-12-24 21:54:40
Subject: Esqsuig(!77. ca ccqyvxxghsqf

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group