pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
plpgsql doesn't check a number of expressions and number of target variables correctly
3+ messages / 2 participants
[nested] [flat]

* plpgsql doesn't check a number of expressions and number of target variables correctly
@ 2012-03-05 19:13 Pavel Stehule <pavel.stehule@gmail.com>
  2012-03-05 19:36 ` Re: plpgsql doesn't check a number of expressions and number of target variables correctly Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Pavel Stehule @ 2012-03-05 19:13 UTC (permalink / raw)
  To: pgsql-bugs

Hello

I found a plpgsql bug:

create or replace function fx()
returns void as $$
declare a int; b int;
begin
  select 10,20 into a;
end;
$$ language plpgsql;

this is bug, or minimally potential source of strange behave.

Regards

Pavel Stehule



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

* Re: plpgsql doesn't check a number of expressions and number of target variables correctly
  2012-03-05 19:13 plpgsql doesn't check a number of expressions and number of target variables correctly Pavel Stehule <pavel.stehule@gmail.com>
@ 2012-03-05 19:36 ` Tom Lane <tgl@sss.pgh.pa.us>
  2012-03-05 20:08   ` Re: plpgsql doesn't check a number of expressions and number of target variables correctly Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2012-03-05 19:36 UTC (permalink / raw)
  To: Pavel Stehule <pavel.stehule@gmail.com>; +Cc: pgsql-bugs

Pavel Stehule <pavel.stehule@gmail.com> writes:
> Hello
> I found a plpgsql bug:

> create or replace function fx()
> returns void as $$
> declare a int; b int;
> begin
>   select 10,20 into a;
> end;
> $$ language plpgsql;

> this is bug, or minimally potential source of strange behave.

AFAICS this is intentional --- see the comment in exec_move_row.

In any case, I think tightening it up is more likely to break working
applications than do anything helpful.

			regards, tom lane



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

* Re: plpgsql doesn't check a number of expressions and number of target variables correctly
  2012-03-05 19:13 plpgsql doesn't check a number of expressions and number of target variables correctly Pavel Stehule <pavel.stehule@gmail.com>
  2012-03-05 19:36 ` Re: plpgsql doesn't check a number of expressions and number of target variables correctly Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-03-05 20:08   ` Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Pavel Stehule @ 2012-03-05 20:08 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs

2012/3/5 Tom Lane <tgl@sss.pgh.pa.us>:
> Pavel Stehule <pavel.stehule@gmail.com> writes:
>> Hello
>> I found a plpgsql bug:
>
>> create or replace function fx()
>> returns void as $$
>> declare a int; b int;
>> begin
>>   select 10,20 into a;
>> end;
>> $$ language plpgsql;
>
>> this is bug, or minimally potential source of strange behave.
>
> AFAICS this is intentional --- see the comment in exec_move_row.
>
> In any case, I think tightening it up is more likely to break working
> applications than do anything helpful.

I agree with you about break working application :( But this is good
example what should be checked in CHECK statement.

but it should be bug - it has no sense - no in this form - it is
assign row to scalar.

I found a some mysterious and very difficult identified bugs in one
application based on this behave.

Regards

Pavel

>
>                        regards, tom lane



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


end of thread, other threads:[~2012-03-05 20:08 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-03-05 19:13 plpgsql doesn't check a number of expressions and number of target variables correctly Pavel Stehule <pavel.stehule@gmail.com>
2012-03-05 19:36 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-03-05 20:08   ` 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