plpgsql doesn't check a number of expressions and number of target variables correctly

Started by Pavel Stehuleabout 14 years ago3 messagesbugs
Jump to latest
#1Pavel Stehule
pavel.stehule@gmail.com

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pavel Stehule (#1)
Re: plpgsql doesn't check a number of expressions and number of target variables correctly

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

#3Pavel Stehule
pavel.stehule@gmail.com
In reply to: Tom Lane (#2)
Re: plpgsql doesn't check a number of expressions and number of target variables correctly

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

Show quoted text

                       regards, tom lane