From 4d06e86d041b48a2ecd4f45e2ecbbcf69f3454c0 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 30 May 2006 13:40:56 +0000 Subject: Revert patch, needs more work: --------------------------------------------------------------------------- Add dynamic record inspection to PL/PgSQL, useful for generic triggers: tval2 := r.(cname); or columns := r.(*); Titus von Boxberg --- src/test/regress/expected/plpgsql.out | 38 ----------------------------------- src/test/regress/sql/plpgsql.sql | 32 ----------------------------- 2 files changed, 70 deletions(-) (limited to 'src/test') diff --git a/src/test/regress/expected/plpgsql.out b/src/test/regress/expected/plpgsql.out index e20d76c0aeb..6e6597dadb2 100644 --- a/src/test/regress/expected/plpgsql.out +++ b/src/test/regress/expected/plpgsql.out @@ -2725,44 +2725,6 @@ 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$ <>declare a integer; b varchar; c varchar; r record; diff --git a/src/test/regress/sql/plpgsql.sql b/src/test/regress/sql/plpgsql.sql index 05460629860..19e145be65f 100644 --- a/src/test/regress/sql/plpgsql.sql +++ b/src/test/regress/sql/plpgsql.sql @@ -2281,38 +2281,6 @@ begin end; $$ language plpgsql; --- 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(); -drop table ritest; -drop function test_record(); - - -- using list of scalars in fori and fore stmts create function for_vect() returns void as $proc$ <>declare a integer; b varchar; c varchar; r record; -- cgit v1.2.3