Skip to content

Commit 9305c5c

Browse files
committed
add note
1 parent 6365c15 commit 9305c5c

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

expected/plpgsql_check_active.out

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3675,7 +3675,12 @@ create type tp as (a int, b int);
36753675
create or replace function dyn_sql_2()
36763676
returns void as $$
36773677
declare
3678-
r tp;
3678+
/*
3679+
* note: plpgsql doesn't support passing some necessary details for record
3680+
* type. The parser setup for dynamic SQL column doesn't use ref hooks, and
3681+
* then it cannot to pass TupleDesc info to query.
3682+
*/
3683+
r tp;
36793684
result int;
36803685
begin
36813686
select 10 a, 20 b into r;
@@ -3686,11 +3691,12 @@ begin
36863691
end;
36873692
$$ language plpgsql;
36883693
select * from plpgsql_check_function('dyn_sql_2', security_warnings := true);
3689-
plpgsql_check_function
3690-
------------------------------------------------------------
3691-
error:42703:9:EXECUTE:column "c" not found in data type tp
3694+
plpgsql_check_function
3695+
-------------------------------------------------------------
3696+
error:42703:14:EXECUTE:column "c" not found in data type tp
36923697
Query: select $1.c
36933698
-- ^
36943699
(3 rows)
36953700

36963701
drop function dyn_sql_2();
3702+
drop type tp;

sql/plpgsql_check_active.sql

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2672,7 +2672,12 @@ create type tp as (a int, b int);
26722672
create or replace function dyn_sql_2()
26732673
returns void as $$
26742674
declare
2675-
r tp;
2675+
/*
2676+
* note: plpgsql doesn't support passing some necessary details for record
2677+
* type. The parser setup for dynamic SQL column doesn't use ref hooks, and
2678+
* then it cannot to pass TupleDesc info to query.
2679+
*/
2680+
r tp;
26762681
result int;
26772682
begin
26782683
select 10 a, 20 b into r;
@@ -2686,3 +2691,5 @@ $$ language plpgsql;
26862691
select * from plpgsql_check_function('dyn_sql_2', security_warnings := true);
26872692

26882693
drop function dyn_sql_2();
2694+
2695+
drop type tp;

0 commit comments

Comments
 (0)