pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #5920: SQL function are probably "overoptimized"
2+ messages / 2 participants
[nested] [flat]

* BUG #5920: SQL function are probably "overoptimized"
@ 2011-03-08 03:49  Matyas Novak <logik@centrum.cz>
  0 siblings, 1 reply; 2+ messages in thread

From: Matyas Novak @ 2011-03-08 03:49 UTC (permalink / raw)
  To: pgsql-bugs


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



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

* Re: BUG #5920: SQL function are probably "overoptimized"
@ 2011-03-08 04:27  Itagaki Takahiro <itagaki.takahiro@gmail.com>
  parent: Matyas Novak <logik@centrum.cz>
  0 siblings, 0 replies; 2+ messages in thread

From: Itagaki Takahiro @ 2011-03-08 04:27 UTC (permalink / raw)
  To: Matyas Novak <logik@centrum.cz>; +Cc: pgsql-bugs

On Tue, Mar 8, 2011 at 12:49, Matyas Novak <logik@centrum.cz> wrote:
> Bug reference:      5920
>
> 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...

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

-- 
Itagaki Takahiro



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


end of thread, other threads:[~2011-03-08 04:27 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-03-08 03:49 BUG #5920: SQL function are probably "overoptimized" Matyas Novak <logik@centrum.cz>
2011-03-08 04:27 ` Itagaki Takahiro <itagaki.takahiro@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