Re: query that worked in 8.1 not working in 8.4

From: Sean Foreman <sean(dot)foreman(at)mpaygateway(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: query that worked in 8.1 not working in 8.4
Date: 2009-08-27 20:48:34
Message-ID: 4A96F122.2050002@mpaygateway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This is not an autocast issue. These are all integers.

The query plan postgres is choosing to execute looks questionable. I
have provided an example of a working query and non-working query. The
change is subtle and takes advantage of the questionable query plan to
get the results I need. The join between customer and merchant looks
incorrect. It should be joining merchant_set and merchant and then
hitting customer. I'm not an expert at reading postgres query plans so I
need some help figuring out if this is a postgres bug or a poorly
written query and why. I think it may be a bug.
> On Thu, Aug 27, 2009 at 2:13 PM, Sean
> Foreman<sean(dot)foreman(at)mpaygateway(dot)com> wrote:
>
>> We recently upgraded postgres from 8.1 to 8.4.
>>
>> One of our queries stopped working and after some digging I've narrowed the
>> problem down to this:
>>
>> table structure of interest:
>>
>> merchant_set
>> merchant_set_id
>>
>> merchant
>> merchant_id
>> merchant_set_id
>>
>> customer
>> customer_id
>> merchant_set_id
>>
>
> So what data types are these? I'm guessing you're being bitten by
> some auto-cast that got removed in 8.3. But that's just a guess.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sean Foreman 2009-08-27 20:50:44 Re: query that worked in 8.1 not working in 8.4
Previous Message Sergey Samokhin 2009-08-27 20:42:59 A safe way to upgrade table definitions by using ALTER's