From 08dc2af91e3e7bf0b1460da3e2026bec6593beaa Mon Sep 17 00:00:00 2001
From: Neil Conway <neilc@samurai.com>
Date: Wed, 14 Sep 2005 18:35:38 +0000
Subject: [PATCH] Tweak the PL/PgSQL regression tests to catch the recently
 reported bug in parsing cursor declarations.

---
 src/test/regress/expected/plpgsql.out | 10 +++++-----
 src/test/regress/sql/plpgsql.sql      | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/test/regress/expected/plpgsql.out b/src/test/regress/expected/plpgsql.out
index 42dcad5c2fb..170669c62bd 100644
--- a/src/test/regress/expected/plpgsql.out
+++ b/src/test/regress/expected/plpgsql.out
@@ -2268,12 +2268,12 @@ commit;
 -- should fail
 fetch next from test1;
 ERROR:  cursor "test1" does not exist
-create function refcursor_test2(int) returns boolean as $$
+create function refcursor_test2(int, int) returns boolean as $$
 declare
-    c1 cursor (param integer) for select * from rc_test where a > param;
+    c1 cursor (param1 int, param2 int) for select * from rc_test where a > param1 and b > param2;
     nonsense record;
 begin
-    open c1($1);
+    open c1($1, $2);
     fetch c1 into nonsense;
     close c1;
     if found then
@@ -2283,8 +2283,8 @@ begin
     end if;
 end
 $$ language 'plpgsql';
-select refcursor_test2(20000) as "Should be false",
-       refcursor_test2(20) as "Should be true";
+select refcursor_test2(20000, 20000) as "Should be false",
+       refcursor_test2(20, 20) as "Should be true";
  Should be false | Should be true 
 -----------------+----------------
  f               | t
diff --git a/src/test/regress/sql/plpgsql.sql b/src/test/regress/sql/plpgsql.sql
index 3432b5556cc..fdb2f46ff89 100644
--- a/src/test/regress/sql/plpgsql.sql
+++ b/src/test/regress/sql/plpgsql.sql
@@ -1926,12 +1926,12 @@ commit;
 -- should fail
 fetch next from test1;
 
-create function refcursor_test2(int) returns boolean as $$
+create function refcursor_test2(int, int) returns boolean as $$
 declare
-    c1 cursor (param integer) for select * from rc_test where a > param;
+    c1 cursor (param1 int, param2 int) for select * from rc_test where a > param1 and b > param2;
     nonsense record;
 begin
-    open c1($1);
+    open c1($1, $2);
     fetch c1 into nonsense;
     close c1;
     if found then
@@ -1942,8 +1942,8 @@ begin
 end
 $$ language 'plpgsql';
 
-select refcursor_test2(20000) as "Should be false",
-       refcursor_test2(20) as "Should be true";
+select refcursor_test2(20000, 20000) as "Should be false",
+       refcursor_test2(20, 20) as "Should be true";
 
 --
 -- tests for "raise" processing
-- 
GitLab