Re: [BUGS] BUG #5084: Query gives different number of rows depending on ORDER BY

2009-09-28 Thread Tom Lane
"Bernt Marius Johnsen" writes: > Description:Query gives different number of rows depending on ORDER > BY The attached patch should fix this. regards, tom lane Index: src/backend/optimizer/README ===

Re: [BUGS] BUG #5084: Query gives different number of rows depending on ORDER BY

2009-09-28 Thread Andrew Gierth
> "Tom" == Tom Lane writes: Tom> I'm inclined to think that the best solution is to have Tom> process_equivalence just reject any clauses that have equal() Tom> left and right sides, ie, throw them back to be processed as Tom> ordinary non-equivalence clauses. >> Hmm. Is it ever possibl

Re: [BUGS] BUG #5084: Query gives different number of rows depending on ORDER BY

2009-09-28 Thread Tom Lane
Andrew Gierth writes: > "Tom" == Tom Lane writes: > Tom> I'm inclined to think that the best solution is to have > Tom> process_equivalence just reject any clauses that have equal() > Tom> left and right sides, ie, throw them back to be processed as > Tom> ordinary non-equivalence clauses. >

Re: [BUGS] BUG #5084: Query gives different number of rows depending on ORDER BY

2009-09-28 Thread Andrew Gierth
> "Tom" == Tom Lane writes: Tom> After digging into it, I find that: Tom> 1. Without ORDER BY, process_equivalence generates an Tom> equivalence class that lists k twice. This is pretty bogus but Tom> it happens to produce the desired results in the example at Tom> hand. (In some othe

Re: [BUGS] BUG #5084: Query gives different number of rows depending on ORDER BY

2009-09-28 Thread Tom Lane
Tom Lane writes: > Andrew Gierth writes: >> Notice that the (k = k) qual is being dropped somewhere, which changes >> the output since that's a disguised not-null condition. > Huh ... I'm surprised it only does that with the ORDER BY present. > I suppose it's got something to do with the equival

Re: [BUGS] BUG #5084: Query gives different number of rows depending on ORDER BY

2009-09-28 Thread Tom Lane
Andrew Gierth writes: > Notice that the (k = k) qual is being dropped somewhere, which changes > the output since that's a disguised not-null condition. Huh ... I'm surprised it only does that with the ORDER BY present. I suppose it's got something to do with the equivalence-class machinery.

Re: [BUGS] BUG #5084: Query gives different number of rows depending on ORDER BY

2009-09-28 Thread Andrew Gierth
> Bernt Marius Johnsen wrote: >> Dump of the database: To save anyone else the bother, there's a VASTLY simpler testcase for this one, requiring no tables at all: test1=# explain select * from (values (1),(null)) v(k) where k = k order by k; QUERY PLAN

Re: [BUGS] BUG #5084: Query gives different number of rows depending on ORDER BY

2009-09-28 Thread Bernt M. Johnsen
Heikki Linnakangas wrote (2009-09-28 18:10:07): > Bernt Marius Johnsen wrote: > > Dump of the database: Attached. > > It looks like the dump got word-wrapped somewhere along the way. Could > you gzip it and post it again, please? > > -- > Heikki Linnakangas > EnterpriseDB ht

Re: [BUGS] BUG #5084: Query gives different number of rows depending on ORDER BY

2009-09-28 Thread Heikki Linnakangas
Bernt Marius Johnsen wrote: > Dump of the database: It looks like the dump got word-wrapped somewhere along the way. Could you gzip it and post it again, please? -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)