SPI: ERROR: no snapshot has been set

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема SPI: ERROR: no snapshot has been set
Дата
Msg-id 20050813135956.GB24155@svana.org
обсуждение исходный текст
Ответы Re: SPI: ERROR: no snapshot has been set  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: SPI: ERROR: no snapshot has been set  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-hackers
[Please CC any replies, thanks]

Hi,

I got this nice error, and according to Tom Lane[1]:

> Depending on what PG version you're using (which you did not say,
> naughty naughty) there are paths in interactive query entry that
> might try to execute datatype input functions before setting the
> query snapshot. But I don't believe it can happen down inside SPI.

[1] http://www.dbforums.com/archive/index.php/t-1065541.html

Good guess, I am inside a type input function trying to use SPI. My
questions are:

- I'm using 7.4, is this fixed/changed in later versions?
- I'm triggering it with: select 'hello'::mytype;
 Is there an easy way of testing my function without triggering this?

select (select 'hello'::mytype);    -- Same problem
select (select 'hello')::mytype     -- gives something about casting unknown
\copy .. from stdin                 -- Works but is inconvenient

- 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?

Thanks in advance,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

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

Предыдущее
От: strk@refractions.net
Дата:
Сообщение: Re: GiST memory usage
Следующее
От: Tom Lane
Дата:
Сообщение: Re: DROP OWNED BY