Re: [HACKERS] don't know whether nodes of type 719 are equal - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] don't know whether nodes of type 719 are equal
Date
Msg-id 199910180049.UAA19914@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] don't know whether nodes of type 719 are equal  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] don't know whether nodes of type 719 are equal  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> (consults include/nodes/nodes.h ... hmm, "SortClause" ...)
> 
> This is probably happening because UNION/INTERSECT processing tries
> to simplify the node tree using cnfify(), which is really designed
> to work on expressions not whole queries.  Ordinarily you can't get a
> sort clause into a subclause of a UNION ... but I guess with DISTINCT
> you can.  (I bet UNIONing things containing GROUP BY fails too,
> since equal() doesn't know about GroupClause nodes either.)
> 
> A quick-fix answer is to extend equal(), of course, but I've been
> wondering for a while why we are cnfify'ing UNION/INTERSECT trees
> at all.  The odds of being able to simplify the tree that way seem
> small, and what's worse is that UNION does *not* have the same
> semantics as OR (eg, foo UNION foo should *not* be simplified to foo)
> but cnfify doesn't know that.

My recollection is that cnfify is not called to simplify, but was
required at one point so you got the right output.  That may no longer
be the case, but I know it was at some point.  Before installed kqso,
the author tried to just skip cnfify, and the query with OR's didn't
work.  Of course, none of us understood cnfify(), so just scratched our
heads.


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: "Hiroshi Inoue"
Date:
Subject: RE: [HACKERS] vacuum of permanently updating database
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Re: ORACLE COMMENT statement