Re: cross-database time extract?

Поиск
Список
Период
Сортировка
От Israel Brewster
Тема Re: cross-database time extract?
Дата
Msg-id 2C345B0E-1E6F-4B89-8855-4CC6C1087786@frontierflying.com
обсуждение исходный текст
Ответ на Re: cross-database time extract?  (Adrian Klaver <aklaver@comcast.net>)
Список pgsql-general
On Dec 29, 2009, at 5:41 AM, Adrian Klaver wrote:

> On Monday 28 December 2009 8:58:38 am Israel Brewster wrote:
>> On Dec 24, 2009, at 12:53 PM, Adrian Klaver wrote:
>>> 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' ...
>>>> -----------------------------------------------
>>>> Israel Brewster
>>>> Computer Support Technician II
>>>> Frontier Flying Service Inc.
>>>> 5245 Airport Industrial Rd
>>>> Fairbanks, AK 99709
>>>> (907) 450-7250 x293
>>>> -----------------------------------------------
>>>
>>> select cast(timestamp_column as time) from table_name
>>
>> Didn't realize you could do that- thanks. This does work, sort of...
>> In PosgreSQL, it returns the time portion of the timestamp as
>> desired.
>> However, in SQLite, while the function runs, it returns the year
>> portion of the timestamp, rather than the time. That would seem to be
>> a SQLite issue/question however. Thanks for the suggestion.
>>
>>> --
>>> Adrian Klaver
>>> aklaver@comcast.net
>
>
> It would seem that the best solution is your original one of SELECT
> time(timestamp_field). This works in the three databases you
> mentioned with the
> provision that you have to double quote "time" in Postgres.

Agreed. It's fairly easy to add the quotes when needed, after which
everything works as desired. Thanks for all the feedback and
explanations!

>
>
>
> --
> Adrian Klaver
> aklaver@comcast.net
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------




Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Planner Row Estimate with Function
Следующее
От: "Leonardo M." Ramé
Дата:
Сообщение: Re: DDL commands take forever