BUG #16121: 12 regression: Volatile function in target list subquery behave as stable

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: elprans(at)gmail(dot)com
Subject: BUG #16121: 12 regression: Volatile function in target list subquery behave as stable
Date: 2019-11-18 01:26:30
Message-ID: 16121-b8e8dc82e608b89d@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: 16121
Logged by: Elvis Pranskevichus
Email address: elprans(at)gmail(dot)com
PostgreSQL version: 12.1
Operating system: Gentoo Linux
Description:

There seems to be a regression in Postgres 12 related to how volatile
functions are handled. If put inside a subquery in the target list, the
volatile function seems to behave like a stable one:

volatility=# SELECT
v.i,
(SELECT random() from (values (v.i)) as q) AS v1
FROM
generate_series(1, 2) as v(i);
i │ v1
───┼────────────────────
1 │ 0.8303615124282295
2 │ 0.8303615124282295
(2 rows)

Postgres 11 and earlier worked correctly:

volatility=# SELECT
v.i,
(SELECT random() from (values (v.i)) as q) AS v1
FROM
generate_series(1, 2) as v(i);
i │ v1
───┼───────────────────
1 │ 0.137472071684897
2 │ 0.288798084016889
(2 rows)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-11-18 01:27:22 BUG #16122: segfault pg_detoast_datum (datum=0x0) at fmgr.c:1833 numrange query
Previous Message Floris Van Nee 2019-11-17 20:56:13 Re: incorrect pg_dump output due to not handling dropped roles correctly