From a6b327e90a8d7c7fe7f64cd2e3ed8535282ff7ff Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 26 Nov 2022 13:39:25 +0100 Subject: cleanup: VCOL_NOT_VIRTUAL->VCOL_NEXTVAL rename to stress that is a specific hack for Item_func_nextval and should not be used for other items. If a vcol uses Item_func_nextval, a corresponding table for the sequence should be added to the prelocking list (in that sense NEXTVAL is not simply a function, but more like a subquery), see add_internal_tables() in DML_prelocking_strategy::handle_table(). At the moment it is only implemented for DEFAULT, not for GENERATED ALWAYS AS, thus the VCOL_NEXTVAL hack. --- sql/field.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sql/field.h') diff --git a/sql/field.h b/sql/field.h index 4ef4483a15a..757a6cc23d0 100644 --- a/sql/field.h +++ b/sql/field.h @@ -528,10 +528,10 @@ static inline const char *vcol_type_name(enum_vcol_info_type type) #define VCOL_FIELD_REF 1 #define VCOL_NON_DETERMINISTIC 2 #define VCOL_SESSION_FUNC 4 /* uses session data, e.g. USER or DAYNAME */ -#define VCOL_TIME_FUNC 8 +#define VCOL_TIME_FUNC 8 /* safe for SBR */ #define VCOL_AUTO_INC 16 #define VCOL_IMPOSSIBLE 32 -#define VCOL_NOT_VIRTUAL 64 /* Function can't be virtual */ +#define VCOL_NEXTVAL 64 /* NEXVAL is not implemented for vcols */ #define VCOL_NOT_STRICTLY_DETERMINISTIC \ (VCOL_NON_DETERMINISTIC | VCOL_TIME_FUNC | VCOL_SESSION_FUNC) @@ -4965,5 +4965,4 @@ ulonglong TABLE::vers_start_id() const return static_cast(vers_start_field()->val_int()); } - #endif /* FIELD_INCLUDED */ -- cgit v1.2.1 From ae53f684d3d02c1ef342891087fa0326b601c2fd Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 27 Nov 2022 14:09:01 +0100 Subject: MDEV-30016 Virtual columns do not support autoincrement columns change vcol_upgrade test to use stored gcols --- sql/field.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql/field.h') diff --git a/sql/field.h b/sql/field.h index 757a6cc23d0..ce15184ea1d 100644 --- a/sql/field.h +++ b/sql/field.h @@ -498,6 +498,8 @@ enum enum_vcol_info_type VCOL_GENERATED_VIRTUAL, VCOL_GENERATED_STORED, VCOL_DEFAULT, VCOL_CHECK_FIELD, VCOL_CHECK_TABLE, /* Additional types should be added here */ + + VCOL_GENERATED_VIRTUAL_INDEXED, // this is never written in .frm /* Following is the highest value last */ VCOL_TYPE_NONE = 127 // Since the 0 value is already in use }; @@ -507,6 +509,7 @@ static inline const char *vcol_type_name(enum_vcol_info_type type) switch (type) { case VCOL_GENERATED_VIRTUAL: + case VCOL_GENERATED_VIRTUAL_INDEXED: case VCOL_GENERATED_STORED: return "GENERATED ALWAYS AS"; case VCOL_DEFAULT: -- cgit v1.2.1