Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id C66BB1337B4E for ; Mon, 7 Mar 2011 23:49:19 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 57300-01 for ; Tue, 8 Mar 2011 03:49:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id F3775133616B for ; Mon, 7 Mar 2011 23:49:18 -0400 (AST) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p283nJKv074027 for ; Tue, 8 Mar 2011 03:49:19 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p283nJjf074026; Tue, 8 Mar 2011 03:49:19 GMT (envelope-from www) Date: Tue, 8 Mar 2011 03:49:19 GMT Message-Id: <201103080349.p283nJjf074026@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #5920: SQL function are probably "overoptimized" From: "Matyas Novak" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201103/141 X-Sequence-Number: 29651 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...