Re: BUG #14105: regression for right join - failed to build any 2-way joins

Lists: Postg토토SQL : Postg토토SQL 메일 링리스트 : 2016-04-21 이후 PGSQL-BUGS 21:18
From: vojta(dot)rylko(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14105: regression for right join - failed to build any 2-way joins
Date: 2016-04-20 19:47:58
Message-ID: 20160420194758.22924.80319@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14105
Logged by: Vojtech Rylko
Email address: vojta(dot)rylko(at)gmail(dot)com
PostgreSQL version: 9.5.2
Operating system: Linux version 3.16.0-30-generic
Description:

I have problem with right join which uses coalesce in join condition. With
other type of join or without coalesce query works.

Minimal reproducer:

create table a as (select 1 as id);
select *
from ((
a as a1
full join (select 1 as id) as tt
on (a1.id = tt.id)
)
right join (select 1 as id) as tt2
on (coalesce(tt.id) = tt2.id)
)
;
ERROR: XX000: failed to build any 2-way joins
LOCATION: standard_join_search, allpaths.c:1832

It works on PostgreSQL 9.2.13., returning:
id | id | id
----+----+----
1 | 1 | 1
(1 row)

Cheers,
V.


From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: vojta(dot)rylko(at)gmail(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14105: regression for right join - failed to build any 2-way joins
Date: 2016-04-21 21:18:48
Message-ID: CAKFQuwaR9RsfevU-8Lcwx=B7P9vQWj12Z=dX03ia6bOfKMFjvA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토SQL : Postg토토SQL 메일 링리스트 : 2016-04-21 이후 PGSQL-BUGS 21:18

On Wed, Apr 20, 2016 at 12:47 PM, <vojta(dot)rylko(at)gmail(dot)com> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 14105
> Logged by: Vojtech Rylko
> Email address: vojta(dot)rylko(at)gmail(dot)com
> PostgreSQL version: 9.5.2
> Operating system: Linux version 3.16.0-30-generic
> Description:
>
> I have problem with right join which uses coalesce in join condition. With
> other type of join or without coalesce query works.
>
> Minimal reproducer:
>
> create table a as (select 1 as id);
> select *
> from ((
> a as a1
> full join (select 1 as id) as tt
> on (a1.id = tt.id)
> )
> right join (select 1 as id) as tt2
> on (coalesce(tt.id) = tt2.id)
> )
> ;
> ERROR: XX000: failed to build any 2-way joins
> LOCATION: standard_join_search, allpaths.c:1832
>
>
> It works on PostgreSQL 9.2.13., returning:
> id | id | id
> ----+----+----
> 1 | 1 | 1
> (1 row)
>
> Cheers,
> V.
>

​Sounds familiar...

Anyway I confirmed on 9.5.2​

​and also see it on 9.3.12

No ready access to 9.4 or 9.2

David J.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: vojta(dot)rylko(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14105: regression for right join - failed to build any 2-way joins
Date: 2016-04-22 00:06:59
Message-ID: 9386.1461283619@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

vojta(dot)rylko(at)gmail(dot)com writes:
> I have problem with right join which uses coalesce in join condition. With
> other type of join or without coalesce query works.

I've pushed a fix for this. Thanks for the report and test case!

regards, tom lane