Re: Unexpected Statement Caching with CURRENT_TIMESTAMP

Поиск
Список
Период
Сортировка
От Markus Schaber
Тема Re: Unexpected Statement Caching with CURRENT_TIMESTAMP
Дата
Msg-id 44DC4002.60208@logix-tt.com
обсуждение исходный текст
Ответ на Unexpected Statement Caching with CURRENT_TIMESTAMP  ("Nicholas E. Wakefield" <nwakefield@KineticNetworks.com>)
Список pgsql-jdbc
Hi, Nicolas,

Nicholas E. Wakefield wrote:
> I'm executing 'SELECT CURRENT_TIMESTAMP' from a statement object with
> auto commit off and prepare threshold set to 1. I'm finding that the
> result comes back the same for after multiple calls and instantiations
> of the statement object(The same happens for a prepared statement).
> However this does not occur when I perform a commit before or after
> every call.
>
> Is this expected behaviour?

Yes, it's expected, intended and documented in the PostgreSQL docs:
http://www.postgresql.org/docs/8.1/static/functions-datetime.html

SELECT timeofday(); returns a clock that advances even during
transactions. As it returns a textual representation, you may need to
cast it to a timestamp in some query contexts, though:

select timeofday(); -- returns text
select timeofday()::timestamp; -- returns timestamp - postgresql variant
select CAST(timeofday() AS timestamp) ; -- returns timestamp in sql99

HTH,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org

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

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: SQL query never ends
Следующее
От: "James Im"
Дата:
Сообщение: Re: SQL query never ends