pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error
5+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2018-11-04 15c7293477 4b0c3712c5  Fix bugs in plpgsql's handling of CALL argument lists.
* BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error
@ 2018-11-01 06:41 PG Bug reporting form <noreply@postgresql.org>
  2018-11-01 07:27 ` Re: BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error Pavel Stehule <pavel.stehule@gmail.com>
  2018-11-01 15:52 ` Re: BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error Andrew Gierth <andrew@tao11.riddles.org.uk>
  0 siblings, 2 replies; 5+ messages in thread

From: PG Bug reporting form @ 2018-11-01 06:41 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: stepaunov@gmail.com

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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error
  2018-11-01 06:41 BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error PG Bug reporting form <noreply@postgresql.org>
@ 2018-11-01 07:27 ` Pavel Stehule <pavel.stehule@gmail.com>
  2018-11-01 08:04   ` Re: BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error Pavel Stehule <pavel.stehule@gmail.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Pavel Stehule @ 2018-11-01 07:27 UTC (permalink / raw)
  To: stepaunov@gmail.com; pgsql-bugs@lists.postgresql.org

č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

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error
  2018-11-01 06:41 BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error PG Bug reporting form <noreply@postgresql.org>
  2018-11-01 07:27 ` Re: BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error Pavel Stehule <pavel.stehule@gmail.com>
@ 2018-11-01 08:04   ` Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Pavel Stehule @ 2018-11-01 08:04 UTC (permalink / raw)
  To: stepaunov@gmail.com; pgsql-bugs@lists.postgresql.org

> 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.
>

no, the behave is random. Looks on uninitialized variable

first call in session fails, seconds are ok


> Regards
>
> Pavel
>
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error
  2018-11-01 06:41 BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error PG Bug reporting form <noreply@postgresql.org>
@ 2018-11-01 15:52 ` Andrew Gierth <andrew@tao11.riddles.org.uk>
  2018-11-01 16:11   ` Re: BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error Pavel Stehule <pavel.stehule@gmail.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Andrew Gierth @ 2018-11-01 15:52 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: stepaunov@gmail.com

>>>>> "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)




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error
  2018-11-01 06:41 BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error PG Bug reporting form <noreply@postgresql.org>
  2018-11-01 15:52 ` Re: BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error Andrew Gierth <andrew@tao11.riddles.org.uk>
@ 2018-11-01 16:11   ` Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Pavel Stehule @ 2018-11-01 16:11 UTC (permalink / raw)
  To: Andrew Gierth <andrew@tao11.riddles.org.uk>; +Cc: pgsql-bugs@lists.postgresql.org; stepaunov@gmail.com

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

>
> --
> Andrew (irc:RhodiumToad)
>
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2018-11-01 16:11 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-11-01 06:41 BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean" error PG Bug reporting form <noreply@postgresql.org>
2018-11-01 07:27 ` Pavel Stehule <pavel.stehule@gmail.com>
2018-11-01 08:04   ` Pavel Stehule <pavel.stehule@gmail.com>
2018-11-01 15:52 ` Andrew Gierth <andrew@tao11.riddles.org.uk>
2018-11-01 16:11   ` Pavel Stehule <pavel.stehule@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox