mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error
Table could be marked dependent because it is either 1) an inner table of an outer join, or 2) it is a part of STRAIGHT_JOIN. In case of STRAIGHT_JOIN table->maybe_null should not be assigned. The fix is to set st_table::maybe_null to 'true' only for those tables which are used in outer join. mysql-test/r/select.result: test result mysql-test/t/select.test: test case sql/sql_select.cc: Table could be marked dependent because it is either 1) an inner table of an outer join, or 2) it is a part of STRAIGHT_JOIN. In case of STRAIGHT_JOIN table->maybe_null should not be assigned. The fix is to set st_table::maybe_null to 'true' only for those tables which are used in outer join. sql/sql_select.h: added comment
This commit is contained in:
@@ -2489,7 +2489,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
|
||||
if (s->dependent & table->map)
|
||||
s->dependent |= table->reginfo.join_tab->dependent;
|
||||
}
|
||||
if (s->dependent)
|
||||
if (outer_join & s->table->map)
|
||||
s->table->maybe_null= 1;
|
||||
}
|
||||
/* Catch illegal cross references for outer joins */
|
||||
|
||||
Reference in New Issue
Block a user