Skip site navigation (1) Skip section navigation (2)

Re: BUG #5294: Sorts on more than just the order-by clause

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Allen Johnson <akjohnson78(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5294: Sorts on more than just the order-by clause
Date: 2010-01-22 14:06:13
Message-ID: 407d949e1001220606w16f62e6akd27bc6b9a3db8822@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Fri, Jan 22, 2010 at 2:02 PM, Greg Stark <gsstark(at)mit(dot)edu> wrote:
> The question arises why Postgres can't automatically detect that this
> query is equivalent.

Hm, actually rereading your query it's not technically equivalent.
Since you weren't grouping on contact.id or contact_type.code if you
happened to have multiple contacts that had the same name and address
and multiple codes which had the same name then your query would
consolidate them into one result record. You might know that will
never happen but the database can't prove that's true so it would
never be able to do this transform.


-- 
greg

In response to

Responses

pgsql-bugs by date

Next:From: Milen A. RadevDate: 2010-01-22 15:22:12
Subject: Re: BUG #5290: Simple loop with insert into and check to avoid duplicate values fails
Previous:From: Greg StarkDate: 2010-01-22 14:02:57
Subject: Re: BUG #5294: Sorts on more than just the order-by clause

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group