Re: query that worked in 8.1 not working in 8.4 - Mailing list pgsql-general

From Sean Foreman
Subject Re: query that worked in 8.1 not working in 8.4
Date
Msg-id 4A96F122.2050002@mpaygateway.com
Whole thread Raw
In response to Re: query that worked in 8.1 not working in 8.4  (Scott Marlowe <scott.marlowe@gmail.com>)
List 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.foreman@mpaygateway.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.
>


pgsql-general by date:

Previous
From: Sergey Samokhin
Date:
Subject: A safe way to upgrade table definitions by using ALTER's
Next
From: Sean Foreman
Date:
Subject: Re: query that worked in 8.1 not working in 8.4