From 99fd5cbd410c29381d2ffdfd98705c68fe99fbe3 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 29 Aug 2002 04:12:03 +0000 Subject: FOUND patch was a bit over-enthusiastic: SQL commands that are not INSERT, UPDATE, or DELETE shouldn't change FOUND. IMHO anyway. Also, try to make documentation a little clearer. --- src/pl/plpgsql/src/pl_exec.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index c6522c35b9c..363a04839a4 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.58 2002/08/24 15:00:47 tgl Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.59 2002/08/29 04:12:03 tgl Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -1844,11 +1844,6 @@ exec_stmt_execsql(PLpgSQL_execstate * estate, PLpgSQL_expr *expr = stmt->sqlstmt; bool isnull; - /* - * Set magic FOUND variable to false - */ - exec_set_found(estate, false); - /* * On the first call for this expression generate the plan */ @@ -1927,16 +1922,15 @@ exec_stmt_execsql(PLpgSQL_execstate * estate, case SPI_OK_SELINTO: break; + case SPI_OK_INSERT: + case SPI_OK_DELETE: + case SPI_OK_UPDATE: /* * If the INSERT, DELETE, or UPDATE query affected at least * one tuple, set the magic 'FOUND' variable to true. This * conforms with the behavior of PL/SQL. */ - case SPI_OK_INSERT: - case SPI_OK_DELETE: - case SPI_OK_UPDATE: - if (SPI_processed > 0) - exec_set_found(estate, true); + exec_set_found(estate, (SPI_processed != 0)); break; case SPI_OK_SELECT: -- cgit v1.2.3