summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorkevg <claprix@yandex.ru>2017-03-15 16:32:44 +0300
committerAleksey Midenkov <midenok@gmail.com>2017-05-05 20:36:32 +0300
commitfb0b3e590288564317a8ba048914a3a912e7627c (patch)
tree14a9e77f5f744f945849e1b465046ffadf6e620d /sql/sql_base.cc
parent5a08bd35156fe28726744cd5abbafad4e308b029 (diff)
downloadmariadb-git-fb0b3e590288564317a8ba048914a3a912e7627c.tar.gz
SQL: NATURAL LEFT JOIN for versioned tables [fixes #156]
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index b0fe02aba69..14bc741057b 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -5350,7 +5350,7 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
{
if (!my_strcasecmp(system_charset_info, curr_nj_col->name(), name))
{
- if (nj_col && !curr_nj_col->table_field->field->vers_sys_field())
+ if (nj_col)
{
my_error(ER_NON_UNIQ_ERROR, MYF(0), name, thd->where);
DBUG_RETURN(NULL);
@@ -6379,6 +6379,10 @@ mark_common_columns(THD *thd, TABLE_LIST *table_ref_1, TABLE_LIST *table_ref_2,
bool is_using_column_1;
if (!(nj_col_1= it_1.get_or_create_column_ref(thd, leaf_1)))
goto err;
+
+ if (nj_col_1->field() && nj_col_1->field()->vers_sys_field())
+ continue;
+
field_name_1= nj_col_1->name();
is_using_column_1= using_fields &&
test_if_string_in_list(field_name_1, using_fields);
@@ -6420,9 +6424,8 @@ mark_common_columns(THD *thd, TABLE_LIST *table_ref_1, TABLE_LIST *table_ref_2,
if (!my_strcasecmp(system_charset_info, field_name_1, cur_field_name_2))
{
DBUG_PRINT ("info", ("match c1.is_common=%d", nj_col_1->is_common));
- if ((!it_1.field() || !it_1.field()->vers_sys_field()) &&
- (cur_nj_col_2->is_common ||
- (found && (!using_fields || is_using_column_1))))
+ if (cur_nj_col_2->is_common ||
+ (found && (!using_fields || is_using_column_1)))
{
my_error(ER_NON_UNIQ_ERROR, MYF(0), field_name_1, thd->where);
goto err;