diff options
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/sql/item.cc b/sql/item.cc index 8aec7eb3a78..57647dd2074 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2010, 2021, MariaDB Corporation. + Copyright (c) 2010, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1567,12 +1567,14 @@ bool Item_field::check_vcol_func_processor(void *arg) } } } - if (field && (field->unireg_check == Field::NEXT_NUMBER)) - { - // Auto increment fields are unsupported - return mark_unsupported_function(field_name.str, arg, VCOL_FIELD_REF | VCOL_AUTO_INC); - } - return mark_unsupported_function(field_name.str, arg, VCOL_FIELD_REF); + + uint r= VCOL_FIELD_REF; + if (field && field->unireg_check == Field::NEXT_NUMBER) + r|= VCOL_AUTO_INC; + if (field && field->vcol_info && + field->vcol_info->flags & (VCOL_NOT_STRICTLY_DETERMINISTIC | VCOL_AUTO_INC)) + r|= VCOL_NON_DETERMINISTIC; + return mark_unsupported_function(field_name.str, arg, r); } @@ -7176,6 +7178,25 @@ Item_bin_string::Item_bin_string(THD *thd, const char *str, size_t str_length): } +void Item_bin_string::print(String *str, enum_query_type query_type) +{ + if (!str_value.length()) + { + /* + Historically a bit string such as b'01100001' + prints itself in the hex hybrid notation: 0x61 + In case of an empty bit string b'', the hex hybrid + notation would result in a bad syntax: 0x + So let's print empty bit strings using bit string notation: b'' + */ + static const LEX_CSTRING empty_bit_string= {STRING_WITH_LEN("b''")}; + str->append(empty_bit_string); + } + else + Item_hex_hybrid::print(str, query_type); +} + + void Item_date_literal::print(String *str, enum_query_type query_type) { str->append("DATE'"); |