aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/expected/plpgsql.out
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/regress/expected/plpgsql.out')
-rw-r--r--src/test/regress/expected/plpgsql.out38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/regress/expected/plpgsql.out b/src/test/regress/expected/plpgsql.out
index 6e6597dadb2..e20d76c0aeb 100644
--- a/src/test/regress/expected/plpgsql.out
+++ b/src/test/regress/expected/plpgsql.out
@@ -2725,6 +2725,44 @@ end;
$$ language plpgsql;
ERROR: end label "outer_label" specified for unlabelled block
CONTEXT: compile of PL/pgSQL function "end_label4" near line 5
+-- check introspective records
+create table ritest (i INT4, t TEXT);
+insert into ritest (i, t) VALUES (1, 'sometext');
+create function test_record() returns void as $$
+declare
+ cname text;
+ tval text;
+ ival int4;
+ tval2 text;
+ ival2 int4;
+ columns text[];
+ r RECORD;
+begin
+ SELECT INTO r * FROM ritest WHERE i = 1;
+ ival := r.i;
+ tval := r.t;
+ RAISE NOTICE 'ival=%, tval=%', ival, tval;
+ cname := 'i';
+ ival2 := r.(cname);
+ cname :='t';
+ tval2 := r.(cname);
+ RAISE NOTICE 'ival2=%, tval2=%', ival2, tval2;
+ columns := r.(*);
+ RAISE NOTICE 'fieldnames=%', columns;
+ RETURN;
+end;
+$$ language plpgsql;
+select test_record();
+NOTICE: ival=1, tval=sometext
+NOTICE: ival2=1, tval2=sometext
+NOTICE: fieldnames={i,t}
+ test_record
+-------------
+
+ (1 row)
+
+drop table ritest;
+drop function test_record();
-- using list of scalars in fori and fore stmts
create function for_vect() returns void as $proc$
<<lbl>>declare a integer; b varchar; c varchar; r record;