From c98a923786fdd5c297e3cd0165e39102094277d8 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 13 Dec 2008 02:00:20 +0000 Subject: Fix failure to ensure that a snapshot is available to datatype input functions when they are invoked by the parser. We had been setting up a snapshot at plan time but really it needs to be done earlier, before parse analysis. Per report from Dmitry Koterov. Also fix two related problems discovered while poking at this one: exec_bind_message called datatype input functions without establishing a snapshot, and SET CONSTRAINTS IMMEDIATE could call trigger functions without establishing a snapshot. Backpatch to 8.2. The underlying problem goes much further back, but it is masked in 8.1 and before because we didn't attempt to invoke domain check constraints within datatype input. It would only be exposed if a C-language datatype input function used the snapshot; which evidently none do, or we'd have heard complaints sooner. Since this code has changed a lot over time, a back-patch is hardly risk-free, and so I'm disinclined to patch further than absolutely necessary. --- src/include/parser/analyze.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/parser/analyze.h b/src/include/parser/analyze.h index eb491329426..13e0771d958 100644 --- a/src/include/parser/analyze.h +++ b/src/include/parser/analyze.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/parser/analyze.h,v 1.38 2008/01/01 19:45:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/parser/analyze.h,v 1.39 2008/12/13 02:00:20 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -25,6 +25,8 @@ extern Query *parse_analyze_varparams(Node *parseTree, const char *sourceText, extern Query *parse_sub_analyze(Node *parseTree, ParseState *parentParseState); extern Query *transformStmt(ParseState *pstate, Node *parseTree); +extern bool analyze_requires_snapshot(Node *parseTree); + extern void CheckSelectLocking(Query *qry); extern void applyLockingClause(Query *qry, Index rtindex, bool forUpdate, bool noWait); -- cgit v1.2.3