-
-
Notifications
You must be signed in to change notification settings - Fork 238
Expand file tree
/
Copy pathplpgsql-check.out
More file actions
36 lines (33 loc) · 773 Bytes
/
plpgsql-check.out
File metadata and controls
36 lines (33 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
BEGIN;
set client_min_messages = warning;
create extension if not exists plpgsql_check with schema extensions;
create schema v;
create table v.t1(
a int,
b int
);
create or replace function v.f1()
returns void
language plpgsql
as $$
declare r record;
begin
for r in select * from v.t1
loop
raise notice '%', r.c; -- there is bug - table t1 missing "c" column
end loop;
end;
$$;
select * from v.f1();
f1
----
(1 row)
-- use plpgsql_check_function to check the function for errors
select * from plpgsql_check_function('v.f1()');
plpgsql_check_function
-------------------------------------------------
error:42703:6:RAISE:record "r" has no field "c"
Context: SQL expression "r.c"
(2 rows)
drop schema v cascade;
ROLLBACK;