File tree Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ create schema v;
2
+ create table v.t1(
3
+ a int,
4
+ b int
5
+ );
6
+ create or replace function v.f1()
7
+ returns void
8
+ language plpgsql
9
+ as $$
10
+ declare r record;
11
+ begin
12
+ for r in select * from v.t1
13
+ loop
14
+ raise notice '%', r.c; -- there is bug - table t1 missing "c" column
15
+ end loop;
16
+ end;
17
+ $$;
18
+ select * from v.f1();
19
+ f1
20
+ ----
21
+
22
+ (1 row)
23
+
24
+ -- use plpgsql_check_function to check the function for errors
25
+ select * from plpgsql_check_function('v.f1()');
26
+ plpgsql_check_function
27
+ -------------------------------------------------
28
+ error:42703:6:RAISE:record "r" has no field "c"
29
+ Context: SQL expression "r.c"
30
+ (2 rows)
31
+
32
+ drop schema v cascade;
33
+ NOTICE: drop cascades to 2 other objects
34
+ DETAIL: drop cascades to table v.t1
35
+ drop cascades to function v.f1()
Original file line number Diff line number Diff line change
1
+ create schema v ;
2
+
3
+ create table v .t1(
4
+ a int ,
5
+ b int
6
+ );
7
+
8
+ create or replace function v .f1()
9
+ returns void
10
+ language plpgsql
11
+ as $$
12
+ declare r record;
13
+ begin
14
+ for r in select * from v .t1
15
+ loop
16
+ raise notice ' %' , r .c ; -- there is bug - table t1 missing "c" column
17
+ end loop;
18
+ end;
19
+ $$;
20
+
21
+ select * from v .f1 ();
22
+
23
+ -- use plpgsql_check_function to check the function for errors
24
+ select * from plpgsql_check_function(' v.f1()' );
25
+
26
+ drop schema v cascade;
You can’t perform that action at this time.
0 commit comments