ARRAY(subquery) volatility

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: ARRAY(subquery) volatility
Date: 2005-08-16 06:04:14
Message-ID: 20050816060414.GA6540@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Why does the first query below return the same value for each row
while the second query returns random values? Planner optimization?

test=> SELECT ARRAY(SELECT random()) FROM generate_series(1, 5);
?column?
---------------------
{0.269273371561092}
{0.269273371561092}
{0.269273371561092}
{0.269273371561092}
{0.269273371561092}
(5 rows)

test=> SELECT ARRAY(SELECT random() + x * 0) FROM generate_series(1, 5) AS g(x);
?column?
---------------------
{0.826863945846848}
{0.42534113182935}
{0.36419924318986}
{0.258920902972538}
{0.843205466327819}
(5 rows)

--
Michael Fuhr

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tino Wildenhain 2005-08-16 07:22:34 Re: Testing of MVCC
Previous Message Thomas Hallgren 2005-08-16 05:40:00 Re: pl/Ruby, deprecating plPython and Core