Обсуждение: BUG #5920: SQL function are probably "overoptimized"

Поиск
Список
Период
Сортировка

BUG #5920: SQL function are probably "overoptimized"

От
"Matyas Novak"
Дата:
The following bug has been logged online:

Bug reference:      5920
Logged by:          Matyas Novak
Email address:      logik@centrum.cz
PostgreSQL version: 9.0.1
Operating system:   linux
Description:        SQL function are probably "overoptimized"
Details:

create table a(a integer);
create or replace function f1 (a varchar) returns void volatile language
plpgsql as
$$
begin
  insert into a values(1);
end
$$;

create or replace function f2 () returns void volatile language sql as
$$
  select f1(tmp) from (values ('aa'), ('bb')) _tmp(tmp);
$$;
select f2();

As a result, only one row appears in table a, although two should be
there...

Re: BUG #5920: SQL function are probably "overoptimized"

От
Itagaki Takahiro
Дата:
On Tue, Mar 8, 2011 at 12:49, Matyas Novak <logik@centrum.cz> wrote:
> Bug reference: =C2=A0 =C2=A0 =C2=A05920
>
> create or replace function f2 () returns void volatile language sql as
> $$
> =C2=A0select f1(tmp) from (values ('aa'), ('bb')) _tmp(tmp);
> $$;
> select f2();
>
> As a result, only one row appears in table a, although two should be
> there...

It should be not a bug.
You probably need to define f2 as "returns SETOF void" function.

--=20
Itagaki Takahiro