Re: AW: [HACKERS] having and union in v7beta

Peter Eisentraut <e99re41@docs.uu.se>

From: Peter Eisentraut <e99re41@DoCS.UU.SE>
To: Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>
Cc: "'Tom Lane'" <tgl@sss.pgh.pa.us>, "'Jose Soares'" <jose@sferacarta.com>, "'hackers'" <pgsql-hackers@postgreSQL.org>
Date: 2000-03-02T16:23:35Z
Lists: pgsql-hackers
On Thu, 2 Mar 2000, Zeugswetter Andreas SB wrote:

> But if the two queries are the same, the union CAN be simplified,
> since the union of two identical masses (I don't know the correct word here)
> is still that one mass.

"set" :)

> 
> Thus 6.5 simplification is correct in this particular case.

The issue here seems to be that the queries could have side-effects, such
as

select nextval('sequence1')
  union
select nextval('sequence1')

which should arguably return two distinct rows. I gotta reread SQL's
opinion on this, but I'm sure Tom has already done that. From a
mathematical point of view, I believe your assumption "lexically equal
queries yield mathematically equal sets" is wrong.

-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden