diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-06-24 23:12:06 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-06-24 23:12:06 +0000 |
commit | 6918df16a5483600fb0466b96f813ed5b6927fd8 (patch) | |
tree | 237bd2c849c93cbbcfcd5c85b5a41b478fa59502 /src | |
parent | e11f1677185b1427b697652f7bb4fb08b1b80077 (diff) | |
download | postgresql-6918df16a5483600fb0466b96f813ed5b6927fd8.tar.gz postgresql-6918df16a5483600fb0466b96f813ed5b6927fd8.zip |
plpgsql's PERFORM statement now sets FOUND depending on whether any
rows were returned by the performed query. Per recent pgsql-general
discussion.
Diffstat (limited to 'src')
-rw-r--r-- | src/pl/plpgsql/src/pl_exec.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index ab539dc928a..abfce9b8bd2 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.55 2002/03/25 07:41:10 tgl Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.56 2002/06/24 23:12:06 tgl Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -969,9 +969,11 @@ exec_stmt_assign(PLpgSQL_execstate * estate, PLpgSQL_stmt_assign * stmt) else { /* - * PERFORM: evaluate query and discard result. This cannot share - * code with the assignment case since we do not wish to - * constraint the discarded result to be only one row/column. + * PERFORM: evaluate query and discard result (but set FOUND + * depending on whether at least one row was returned). + * + * This cannot share code with the assignment case since we do not + * wish to constrain the discarded result to be only one row/column. */ int rc; @@ -985,6 +987,8 @@ exec_stmt_assign(PLpgSQL_execstate * estate, PLpgSQL_stmt_assign * stmt) if (rc != SPI_OK_SELECT) elog(ERROR, "query \"%s\" didn't return data", expr->query); + exec_set_found(estate, (estate->eval_processed != 0)); + exec_eval_cleanup(estate); } |