Re: SPI: ERROR: no snapshot has been set

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: SPI: ERROR: no snapshot has been set
Date: 2005-08-13 16:36:42
Message-ID: 8046.1123951002@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Martijn van Oosterhout <kleptog(at)svana(dot)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 function call until runtime. But
* there is no way to represent a typinput function call as an
* expression tree, 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-08-13 16:41:51 Re: psql SET/RESET/SHOW tab completion
Previous Message Michael Fuhr 2005-08-13 16:26:23 Re: psql SET/RESET/SHOW tab completion