BUG #14149: when use LATERAL functions with IMMUTABLE called multiple times

From: turon(dot)david(at)seznam(dot)cz
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14149: when use LATERAL functions with IMMUTABLE called multiple times
Date: 2016-05-19 09:06:09
Message-ID: 20160519090609.12503.12814@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14149
Logged by: David Turon
Email address: turon(dot)david(at)seznam(dot)cz
PostgreSQL version: 9.5.3
Operating system: CENTOS 6
Description:

Hello,

we found strange behavior LATERAL when we upgrade from 9.3.12 to 9.5.3,
simple example:

CREATE OR REPLACE FUNCTION f_imutable(OUT a int, out b int) AS $$
BEGIN
a := 1;
b := 2;
RAISE NOTICE 'call function f_imutable';
END;
$$ LANGUAGE plpgsql IMMUTABLE;

--execution on 9.3.12, for one row one call

SELECT (x.y).a, (x.y).b FROM generate_series(1,1), LATERAL (SELECT
f_imutable()) AS x(y);
NOTICE: call function f_imutable
a | b
---+---
1 | 2
(1 řádka)

--execution on 9.5.3 called 2x

SELECT (x.y).a, (x.y).b FROM generate_series(1,1), LATERAL (SELECT
f_imutable()) AS x(y);

NOTICE: call function f_imutable
NOTICE: call function f_imutable
a | b
---+---
1 | 2
(1 řádka)

I know, its little ugly written, but we don't except this behavior and after
upgrade we saw huge slowdown and we had to downgrade back to 9.3.12. For
VOLATILE fuctions works fine.

Thanks

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message virendra 2016-05-19 12:33:38 BUG #14150: Attempted to delete invisible tuple
Previous Message 自己 2016-05-19 06:47:38 ALTER TABLE can NOT use set (OIDS=true)