Re: PG 7.2b4 bug?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: Don Baccus <dhogaza(at)pacifier(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: PG 7.2b4 bug?
Date: 2001-12-17 21:13:08
Message-ID: 7062.1008623588@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> writes:
> However, I'd think:
> "select (select nextval from test_seq) from multiple_rows;"
> should give you different values and doesn't, although
> "select (select nextval from test_seq where i IS NULL or i IS NOT NULL)
> from multiple_rows;" does give you different values.

In the first case, the subselect is visibly not dependent on the outer
query, so it's evaluated only once; in the second case it has to be
re-evaluated for each row using that row's value of i. You can see the
difference (InitPlan vs. SubPlan) in the query's EXPLAIN output.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Don Baccus 2001-12-17 21:16:40 Re: PG 7.2b4 bug?
Previous Message Tom Lane 2001-12-17 21:08:09 Re: recursive SQL functions