From b2c4071299e02ed96d48d3c8e776de2fab36f88c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 13 Sep 2004 20:10:13 +0000 Subject: Redesign query-snapshot timing so that volatile functions in READ COMMITTED mode see a fresh snapshot for each command in the function, rather than using the latest interactive command's snapshot. Also, suppress fresh snapshots as well as CommandCounterIncrement inside STABLE and IMMUTABLE functions, instead using the snapshot taken for the most closely nested regular query. (This behavior is only sane for read-only functions, so the patch also enforces that such functions contain only SELECT commands.) As per my proposal of 6-Sep-2004; I note that I floated essentially the same proposal on 19-Jun-2002, but that discussion tailed off without any action. Since 8.0 seems like the right place to be taking possibly nontrivial backwards compatibility hits, let's get it done now. --- contrib/tablefunc/tablefunc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'contrib/tablefunc/tablefunc.c') diff --git a/contrib/tablefunc/tablefunc.c b/contrib/tablefunc/tablefunc.c index 212be222cb..063773e91b 100644 --- a/contrib/tablefunc/tablefunc.c +++ b/contrib/tablefunc/tablefunc.c @@ -386,7 +386,7 @@ crosstab(PG_FUNCTION_ARGS) elog(ERROR, "crosstab: SPI_connect returned %d", ret); /* Retrieve the desired rows */ - ret = SPI_exec(sql, 0); + ret = SPI_execute(sql, true, 0); proc = SPI_processed; /* Check for qualifying tuples */ @@ -777,7 +777,7 @@ load_categories_hash(char *cats_sql, MemoryContext per_query_ctx) elog(ERROR, "load_categories_hash: SPI_connect returned %d", ret); /* Retrieve the category name rows */ - ret = SPI_exec(cats_sql, 0); + ret = SPI_execute(cats_sql, true, 0); num_categories = proc = SPI_processed; /* Check for qualifying tuples */ @@ -855,7 +855,7 @@ get_crosstab_tuplestore(char *sql, elog(ERROR, "get_crosstab_tuplestore: SPI_connect returned %d", ret); /* Now retrieve the crosstab source rows */ - ret = SPI_exec(sql, 0); + ret = SPI_execute(sql, true, 0); proc = SPI_processed; /* Check for qualifying tuples */ @@ -1376,7 +1376,7 @@ build_tuplestore_recursively(char *key_fld, } /* Retrieve the desired rows */ - ret = SPI_exec(sql->data, 0); + ret = SPI_execute(sql->data, true, 0); proc = SPI_processed; /* Check for qualifying tuples */ -- cgit v1.2.3