diff options
author | Alexander Barkov <bar@mariadb.com> | 2020-05-16 12:28:03 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2020-05-16 12:28:03 +0400 |
commit | 54c169a986e7ac76d4a200661c3ce5712fc06040 (patch) | |
tree | d56934c37fd7caeca280605046eb3c45934068bd /sql/item.h | |
parent | 38d62189a83b0e7293a0ad7fcb79a5fdece3f817 (diff) | |
parent | bf8ae812690a8c20ea17cb5dc24a57be239a8901 (diff) | |
download | mariadb-git-54c169a986e7ac76d4a200661c3ce5712fc06040.tar.gz |
Merge remote-tracking branch 'origin/10.2' into 10.3
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h index 54c4e9a5504..a40f0ab082e 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1342,6 +1342,13 @@ public: a constant expression. Used in the optimizer to propagate basic constants. */ virtual bool basic_const_item() const { return 0; } + /* + Determines if the expression is allowed as + a virtual column assignment source: + INSERT INTO t1 (vcol) VALUES (10) -> error + INSERT INTO t1 (vcol) VALUES (NULL) -> ok + */ + virtual bool vcol_assignment_allowed_value() const { return false; } /* cloning of constant items (0 if it is not const) */ virtual Item *clone_item(THD *thd) { return 0; } virtual Item* build_clone(THD *thd) { return get_copy(thd); } @@ -3267,6 +3274,7 @@ public: collation.set(cs, DERIVATION_IGNORABLE, MY_REPERTOIRE_ASCII); } enum Type type() const { return NULL_ITEM; } + bool vcol_assignment_allowed_value() const { return true; } bool eq(const Item *item, bool binary_cmp) const { return null_eq(item); } double val_real(); longlong val_int(); @@ -3516,6 +3524,21 @@ public: const Type_handler *type_handler() const { return Type_handler_hybrid_field_type::type_handler(); } + bool vcol_assignment_allowed_value() const + { + switch (state) { + case NULL_VALUE: + case DEFAULT_VALUE: + case IGNORE_VALUE: + return true; + case NO_VALUE: + case SHORT_DATA_VALUE: + case LONG_DATA_VALUE: + break; + } + return false; + } + Field::geometry_type get_geometry_type() const { return Type_geometry_attributes::get_geometry_type(); }; @@ -5787,6 +5810,7 @@ public: &null_clex_str), arg(NULL), cached_field(NULL) {} enum Type type() const { return DEFAULT_VALUE_ITEM; } + bool vcol_assignment_allowed_value() const { return arg == NULL; } bool eq(const Item *item, bool binary_cmp) const; bool fix_fields(THD *, Item **); void cleanup(); |