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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to