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.sql24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/regress/sql/plpgsql.sql b/src/test/regress/sql/plpgsql.sql
index bffb7b703b4..588c3310337 100644
--- a/src/test/regress/sql/plpgsql.sql
+++ b/src/test/regress/sql/plpgsql.sql
@@ -1933,6 +1933,30 @@ $$ language plpgsql;
select refcursor_test2(20000, 20000) as "Should be false",
refcursor_test2(20, 20) as "Should be true";
+-- should fail
+create function constant_refcursor() returns refcursor as $$
+declare
+ rc constant refcursor;
+begin
+ open rc for select a from rc_test;
+ return rc;
+end
+$$ language plpgsql;
+
+select constant_refcursor();
+
+-- but it's okay like this
+create or replace function constant_refcursor() returns refcursor as $$
+declare
+ rc constant refcursor := 'my_cursor_name';
+begin
+ open rc for select a from rc_test;
+ return rc;
+end
+$$ language plpgsql;
+
+select constant_refcursor();
+
--
-- tests for cursors with named parameter arguments
--