PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID16121
PG Version12.1
OSGentoo Linux
Opened2019-11-18 01:26:30+00
Reported byElvis Pranskevichus
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      16121
Logged by:          Elvis Pranskevichus
Email address:      (redacted)
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)

Messages

DateAuthorSubject
2019-11-18 01:26:30+00PG Bug reporting formBUG #16121: 12 regression: Volatile function in target list subquery behave as stable
2019-11-18 16:47:55+00Tom LaneRe: BUG #16121: 12 regression: Volatile function in target list subquery behave as stable
2019-11-18 21:37:08+00Elvis PranskevichusRe: BUG #16121: 12 regression: Volatile function in target list subquery behave as stable