BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error
The following bug has been logged on the website:
Bug reference: 15477
Logged by: Alexey Stepanov
Email address: stepaunov@gmail.com
PostgreSQL version: 11.0
Operating system: RedOS (based on Red Hat Linux) (red-soft.ru)
Description:
Calling procedure with named inout refcursor parameter leads to "invalid
input syntax for type boolean" error.
Repro:
/*
select version()
PostgreSQL 11.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623
(Red Hat 4.8.5-28), 64-bit
*/
drop table if exists t1;
drop procedure if exists p1(integer, refcursor);
create table t1 (key serial, name text);
create or replace procedure p1(v_cnt int, v_ResultSet inout refcursor =
null)
as $$
begin
insert into t1 (name) values('name_test');
open v_ResultSet for select * from t1;
end;
$$
language plpgsql security definer
;
-- trying to call with named v_ResultSet parameter
do $$
declare
v_ResultSet refcursor;
v_cnt integer;
begin
call p1(v_cnt:=v_cnt, v_ResultSet := v_ResultSet);
raise notice '%', v_ResultSet;
end;$$
;
result (in pgAdmin3):
ERROR: invalid input syntax for type boolean: "<unnamed portal 7>"
CONTEXT: PL/pgSQL function inline_code_block line 6 at CALL
********** Error **********
ERROR: invalid input syntax for type boolean: "<unnamed portal 7>"
SQL state: 22P02
Context: PL/pgSQL function inline_code_block line 6 at CALL
-- trying to call with ordinal parameters - success!
do $$
declare
v_ResultSet refcursor;
v_cnt integer;
begin
call p1(v_cnt, v_ResultSet);
raise notice '%', v_ResultSet;
end;$$
;
result - ok
čt 1. 11. 2018 v 7:42 odesílatel PG Bug reporting form <
noreply@postgresql.org> napsal:
The following bug has been logged on the website:
Bug reference: 15477
Logged by: Alexey Stepanov
Email address: stepaunov@gmail.com
PostgreSQL version: 11.0
Operating system: RedOS (based on Red Hat Linux) (red-soft.ru)
Description:Calling procedure with named inout refcursor parameter leads to "invalid
input syntax for type boolean" error.Repro:
/*
select version()
PostgreSQL 11.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
20150623
(Red Hat 4.8.5-28), 64-bit
*/drop table if exists t1;
drop procedure if exists p1(integer, refcursor);create table t1 (key serial, name text);
create or replace procedure p1(v_cnt int, v_ResultSet inout refcursor =
null)
as $$
begin
insert into t1 (name) values('name_test');
open v_ResultSet for select * from t1;
end;
$$
language plpgsql security definer
;-- trying to call with named v_ResultSet parameter
do $$
declare
v_ResultSet refcursor;
v_cnt integer;
begin
call p1(v_cnt:=v_cnt, v_ResultSet := v_ResultSet);
raise notice '%', v_ResultSet;
end;$$
;result (in pgAdmin3):
ERROR: invalid input syntax for type boolean: "<unnamed portal 7>"
CONTEXT: PL/pgSQL function inline_code_block line 6 at CALL
********** Error **********ERROR: invalid input syntax for type boolean: "<unnamed portal 7>"
SQL state: 22P02
Context: PL/pgSQL function inline_code_block line 6 at CALL-- trying to call with ordinal parameters - success!
do $$
declare
v_ResultSet refcursor;
v_cnt integer;
begin
call p1(v_cnt, v_ResultSet);
raise notice '%', v_ResultSet;
end;$$
;result - ok
It is strange bug. When you use syntax =>, ":=" is obsolete (but still
supported), then all is working
postgres=# do $$
declare
v_ResultSet refcursor;
v_cnt integer;
begin
call p1(v_cnt=>v_cnt, v_ResultSet => v_ResultSet);
raise notice '%', v_ResultSet;
end;$$
;
NOTICE: <unnamed portal 4>
DO
looks so somewhere only new syntax is recognized and supported.
Regards
Pavel
It is strange bug. When you use syntax =>, ":=" is obsolete (but still
supported), then all is workingpostgres=# do $$
declare
v_ResultSet refcursor;
v_cnt integer;
begin
call p1(v_cnt=>v_cnt, v_ResultSet => v_ResultSet);
raise notice '%', v_ResultSet;
end;$$
;
NOTICE: <unnamed portal 4>
DOlooks so somewhere only new syntax is recognized and supported.
no, the behave is random. Looks on uninitialized variable
first call in session fails, seconds are ok
Show quoted text
Regards
Pavel
"PG" == PG Bug reporting form <noreply@postgresql.org> writes:
PG> Calling procedure with named inout refcursor parameter leads to
PG> "invalid input syntax for type boolean" error.
I got a crash (segfault in exec_assign_value) instead. Investigating.
--
Andrew (irc:RhodiumToad)
Dne čt 1. 11. 2018 16:57 uživatel Andrew Gierth <andrew@tao11.riddles.org.uk>
napsal:
"PG" == PG Bug reporting form <noreply@postgresql.org> writes:
PG> Calling procedure with named inout refcursor parameter leads to
PG> "invalid input syntax for type boolean" error.I got a crash (segfault in exec_assign_value) instead. Investigating.
I sent bugfix to mailing list
Pavel
Show quoted text
--
Andrew (irc:RhodiumToad)