aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/sql/plpgsql.sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/regress/sql/plpgsql.sql')
-rw-r--r--src/test/regress/sql/plpgsql.sql20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/regress/sql/plpgsql.sql b/src/test/regress/sql/plpgsql.sql
index 51bfce2e0c1..c75f037cdbc 100644
--- a/src/test/regress/sql/plpgsql.sql
+++ b/src/test/regress/sql/plpgsql.sql
@@ -2689,6 +2689,26 @@ select forc01();
select * from forc_test;
+-- same, with a cursor whose portal name doesn't match variable name
+create or replace function forc01() returns void as $$
+declare
+ c refcursor := 'fooled_ya';
+ r record;
+begin
+ open c for select * from forc_test;
+ loop
+ fetch c into r;
+ exit when not found;
+ raise notice '%, %', r.i, r.j;
+ update forc_test set i = i * 100, j = r.j * 2 where current of c;
+ end loop;
+end;
+$$ language plpgsql;
+
+select forc01();
+
+select * from forc_test;
+
drop function forc01();
-- fail because cursor has no query bound to it