Re: SPI: ERROR: no snapshot has been set

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SPI: ERROR: no snapshot has been set
Дата
Msg-id 8046.1123951002@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SPI: ERROR: no snapshot has been set  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: SPI: ERROR: no snapshot has been set  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:
> - Is there a way to detect if a snapshot has been started and creating
> one if there hasn't. I've seen the snapshot related functions but I
> don't feel comfortable sticking them in my type input function just to
> fix this. Is it safe?

This would be a pretty bad idea IMHO.  The setting of the first snapshot
in a transaction is a significant event, and it should not happen in
random places like type-specific input functions.

A long-term solution to this might be to do what's envisioned in this
comment in parse_coerce.c:
        * XXX if the typinput function is not immutable, we really ought to        * postpone evaluation of the
functioncall until runtime. But        * there is no way to represent a typinput function call as an        *
expressiontree, because C-string values are not Datums. (XXX        * This *is* possible as of 7.3, do we want to do
it?)

I'm a bit concerned about the possible side-effects of this on existing
behavior, though.  In particular constructs like'now'::timestamp
would change behavior subtly.
        regards, tom lane


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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: psql SET/RESET/SHOW tab completion
Следующее
От: Tom Lane
Дата:
Сообщение: Re: psql SET/RESET/SHOW tab completion