diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-05-18 15:05:52 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-05-18 15:05:52 +0300 |
commit | faf6d0ef3f9323c6d24f8cdb6533ed23d1a6bb40 (patch) | |
tree | 086848c0085880912bec60369effef8ec449c91c /sql/item.h | |
parent | 386f168ab340791631e4d8979c4370ecef7e6b05 (diff) | |
parent | 5e12aca57f19f3e4f623e92637492edf8a69f42f (diff) | |
download | mariadb-git-faf6d0ef3f9323c6d24f8cdb6533ed23d1a6bb40.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sql/item.h b/sql/item.h index b83b997323d..c910ef9acd4 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1576,7 +1576,14 @@ 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; } + /** Test if "this" is an ORDER position (rather than an expression). Notes: - can be called before fix_fields(). @@ -3591,6 +3598,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; } double val_real(); longlong val_int(); String *val_str(String *str); @@ -3837,6 +3845,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(); }; @@ -6273,6 +6296,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(); |