På tirsdag 22. november 2011 kl 08:39:09 skrev Jasmin Dizdarevic <jasmin.dizdarevic@gmail.com>:
Hi,
we have a reporting tool, that sometimes uses this kind of condition.
...WHERE a.field = a.field
To explain this: a.field can be filtered by the user. the user can choose some values. if he does, this condition will be build:
...WHERE a.field IN (1,2,3)
If the user doesn't choose any values the * = * condition is used.
Since 9.1 we're experiencing problems with this construction. Have there been any changes to the planner regarding this?
It would be far easier to give you an answer if you provided a query which worked before which now, in 9.1, gives you trouble.
--
Andreas Joseph Krogh <andreak@officenet.no> - mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
>From pgsql-sql-owner@postgresql.org Tue Nov 22 11:30:06 2011
Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229])
by mail.postgresql.org (Postfix) with ESMTP id 4F6201ED23D7
for ; Tue, 22 Nov 2011 11:30:04 -0400 (AST)
Received: from out02.mta.xmission.com ([166.70.13.232])
by magus.postgresql.org with esmtp (Exim 4.72)
(envelope-from )
id 1RSsIN-0006uX-4u
for pgsql-sql@postgresql.org; Tue, 22 Nov 2011 15:30:04 +0000
Received: from in02.mta.xmission.com ([166.70.13.52])
by out02.mta.xmission.com with esmtps (TLSv1:AES256-SHA:256)
(Exim 4.69)
(envelope-from )
id 1RSsI9-0003kh-C3; Tue, 22 Nov 2011 08:29:49 -0700
Received: from [208.187.158.94] (helo=[172.16.1.26])
by in02.mta.xmission.com with esmtpsa (TLSv1:AES256-SHA:256)
(Exim 4.69)
(envelope-from )
id 1RSsI9-0003n0-0C; Tue, 22 Nov 2011 08:29:49 -0700
Message-ID: <4ECBBFEA.4080005@gmail.com>
Date: Tue, 22 Nov 2011 08:29:46 -0700
From: Rob Sargent
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111101 SUSE/3.1.16 Lightning/1.0b2 Thunderbird/3.1.16
MIME-Version: 1.0
To: pgsql-sql@postgresql.org
References:
In-Reply-To:
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-XM-SPF: eid=;;;mid=;;;hst=in02.mta.xmission.com;;;ip=208.187.158.94;;;frm=robjsargent@gmail.com;;;spf=neutral
X-XM-AID: U2FsdGVkX1/+Tv6z0cwWjrHYirpICGiYIUKQVtNVexE=
X-SA-Exim-Connect-IP: 208.187.158.94
X-SA-Exim-Mail-From: robjsargent@gmail.com
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sa07.xmission.com
X-Spam-Level:
X-Spam-Status: No, score=-0.4 required=8.0 tests=ALL_TRUSTED,BAYES_20,
DCC_CHECK_NEGATIVE,DNS_FROM_RFC_ABUSE,FREEMAIL_FROM,T_TM2_M_HEADER_IN_MSG,
UNTRUSTED_Relay autolearn=disabled version=3.3.1
X-Spam-Report:
* -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
* 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
* (robjsargent[at]gmail.com)
* 0.0 T_TM2_M_HEADER_IN_MSG BODY: T_TM2_M_HEADER_IN_MSG
* -0.0 BAYES_20 BODY: Bayes spam probability is 5 to 20%
* [score: 0.1277]
* -0.0 DCC_CHECK_NEGATIVE Not listed in DCC
* [sa07 1397; Body=1 Fuz1=1 Fuz2=1]
* 0.2 DNS_FROM_RFC_ABUSE Envelope sender in abuse.rfc-ignorant.org
* 0.4 UNTRUSTED_Relay Comes from a non-trusted relay
X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1
X-Spam-Combo: ;pgsql-sql@postgresql.org
X-Spam-Relay-Country:
Subject: Re: Change in 9.1?
X-Spam-Flag: No
X-SA-Exim-Version: 4.2.1 (built Fri, 06 Aug 2010 16:31:04 -0600)
X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com)
X-Archive-Number: 201111/74
X-Sequence-Number: 36047
On 11/22/2011 12:39 AM, Jasmin Dizdarevic wrote:
> Hi,
>
> we have a reporting tool, that sometimes uses this kind of condition.
> ...WHERE a.field = a.field
>
> To explain this: a.field can be filtered by the user. the user can
> choose some values. if he does, this condition will be build:
> ...WHERE a.field IN (1,2,3)
>
> If the user doesn't choose any values the * = * condition is used.
>
> Since 9.1 we're experiencing problems with this construction. Have
> there been any changes to the planner regarding this?
>
> Ty
> Regards, Jasmin
If it's a commercial product please name that reporting tool: clearly
it's to be avoided. If it's an in-house tool clearly it's broken.