Re: Extract Function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Extract Function
Дата
Msg-id 26255.1080328789@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Extract Function  ("Derrick Betts" <Derrick@Blue-Axis.com>)
Список pgsql-novice
"Derrick Betts" <Derrick@Blue-Axis.com> writes:
> This is the command:
> SELECT EXTRACT(EPOCH FROM TIMESTAMP variable_name) INTO Temp;

You're confusing the EXTRACT function with the notation for a literal
constant of a specific type.  The function is just

    EXTRACT(EPOCH FROM timestamp-expression)

An example that involves a literal constant could be written either

    EXTRACT(EPOCH FROM TIMESTAMP '2004-1-10 00:00:00')
    EXTRACT(EPOCH FROM '2004-1-10 00:00:00'::TIMESTAMP)

but when you are dealing with a variable you don't use the TIMESTAMP
decoration, because the parser already knows what datatype the variable
is.  So

    EXTRACT(EPOCH FROM timestamp-variable)

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: how to test string against regular expression contained in postgresql database field?
Следующее
От: Aarni Ruuhimäki
Дата:
Сообщение: Re: Upgrading PostgreSQL