Skip to content
Snippets Groups Projects
user avatar
Tom Lane authored
Given a left join containing a full join in its righthand side, with
the left join's joinclause referencing only one side of the full join
(in a non-strict fashion, so that the full join doesn't get simplified),
the planner could fail with "failed to build any N-way joins" or related
errors.  This happened because the full join was seen as overlapping the
left join's RHS, and then recent changes within join_is_legal() caused
that function to conclude that the full join couldn't validly be formed.
Rather than try to rejigger join_is_legal() yet more to allow this,
I think it's better to fix initsplan.c so that the required join order
is explicit in the SpecialJoinInfo data structure.  The previous coding
there essentially ignored full joins, relying on the fact that we don't
flatten them in the joinlist data structure to preserve their ordering.
That's sufficient to prevent a wrong plan from being formed, but as this
example shows, it's not sufficient to ensure that the right plan will
be formed.  We need to work a bit harder to ensure that the right plan
looks sane according to the SpecialJoinInfos.

Per bug #14105 from Vojtech Rylko.  This was apparently induced by
commit 8703059c (though now that I've seen it, I wonder whether there
are related cases that could have failed before that); so back-patch
to all active branches.  Unfortunately, that patch also went into 9.0,
so this bug is a regression that won't be fixed in that branch.
ad2d32b5
History
Name Last commit Last update
..
.gitignore
abstime.sql
advisory_lock.sql
aggregates.sql
alter_table.sql
arrays.sql
bit.sql
bitmapops.sql
boolean.sql
box.sql
btree_index.sql
case.sql
char.sql
circle.sql
cluster.sql
collate.linux.utf8.sql
collate.sql
combocid.sql
comments.sql
conversion.sql
copy2.sql
copyselect.sql
create_aggregate.sql
create_cast.sql
create_function_3.sql
create_index.sql
create_misc.sql
create_operator.sql
create_table.sql
create_table_like.sql
create_type.sql
create_view.sql
date.sql
delete.sql
dependency.sql
domain.sql
drop.sql
drop_if_exists.sql
enum.sql
equivclass.sql
errors.sql
euc_cn.sql
euc_jp.sql
euc_kr.sql
euc_tw.sql
float4.sql
float8.sql
foreign_data.sql
foreign_key.sql
functional_deps.sql
geometry.sql
guc.sql
hash_index.sql
horology.sql
hs_primary_extremes.sql
hs_primary_setup.sql
hs_standby_allowed.sql
hs_standby_check.sql
hs_standby_disallowed.sql
hs_standby_functions.sql
inet.sql
inherit.sql
insert.sql
int2.sql
int4.sql
int8.sql
interval.sql
join.sql
json.sql
limit.sql
lseg.sql
macaddr.sql
money.sql
mule_internal.sql
name.sql
namespace.sql
numeric.sql
numeric_big.sql
numerology.sql
oid.sql
oidjoins.sql
opr_sanity.sql
path.sql
plancache.sql
plpgsql.sql
point.sql
polygon.sql
polymorphism.sql
portals.sql
portals_p2.sql
prepare.sql
prepared_xacts.sql
privileges.sql
random.sql
rangefuncs.sql
rangetypes.sql
regex.sql
reltime.sql
returning.sql
rowtypes.sql