Re: [GENERAL] Remove useless joins (VARCHAR vs TEXT)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Kim Rose Carlsen <krc(at)hiper(dot)dk>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [GENERAL] Remove useless joins (VARCHAR vs TEXT)
Date: 2017-09-17 19:30:49
Message-ID: 3592.1505676649@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> writes:
> On 17 September 2017 at 08:07, Kim Rose Carlsen <krc(at)hiper(dot)dk> wrote:
>> It seems there are some difference in VARCHAR vs TEXT when postgres tries to
>> decide if a LEFT JOIN is useful or not.

> Yeah, it looks like the code to check for distinctness in the subquery
> fails to consider that the join condition may contain RelabelTypes
> instead of plain Vars.
>
> The attached fixes.

Looks like a good fix to me (except for the copied-and-pasted,
not-quite-on-point comment ;-)). Pushed.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2017-09-17 20:13:10 Selecting a daily puzzle record - which type of column to add?
Previous Message Rafal Pietrak 2017-09-17 09:47:24 Re: looking for a globally unique row ID

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2017-09-17 20:45:06 Re: Log LDAP "diagnostic messages"?
Previous Message Christoph Berg 2017-09-17 18:22:44 Re: Add Roman numeral conversion to to_number