Re: "no snapshot has been set" error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ruey-Lung Hsiao <rlhsiao(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: "no snapshot has been set" error
Date: 2004-11-21 08:23:46
Message-ID: 5825.1101025426@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ruey-Lung Hsiao <rlhsiao(at)gmail(dot)com> writes:
> In my X_in() function, I want to access other table to do some
> bookkeeping stuff. this table keeps track of the number of calls to
> X_in(). However, while SPI_connect() returns SPI_OK_CONNECT, whenever I
> execute SPI_exec( "SELECT count FROM XTABLE", 0), postgres stops
> executing and issues "Error: no snapshot has been set".

Are you sure you've diagnosed this correctly? AFAICS it's not possible
to get into SPI without having set a snapshot. 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. I'd be interested to see a complete
counterexample.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Hansen 2004-11-21 09:19:13 Re: Unicode characters above 0x10000 #2
Previous Message Thomas Hallgren 2004-11-21 08:16:05 Re: Error handling in plperl and pltcl