From f35a2ee8be3b7041e3cc55a7f71e97707cc42eb3 Mon Sep 17 00:00:00 2001 From: Mingcong Han Date: Thu, 12 Nov 2020 10:44:23 +0800 Subject: [PATCH 1/2] cherry pick #20398 to release-3.0 Signed-off-by: ti-srebot --- errors.toml | 1543 ++++++++++++++++++++++++++ executor/ddl_test.go | 17 + planner/core/errors.go | 69 ++ planner/core/logical_plan_builder.go | 35 +- planner/core/planbuilder.go | 70 +- 5 files changed, 1720 insertions(+), 14 deletions(-) create mode 100644 errors.toml diff --git a/errors.toml b/errors.toml new file mode 100644 index 0000000000000..cb673bd2b0611 --- /dev/null +++ b/errors.toml @@ -0,0 +1,1543 @@ +# AUTOGENERATED BY github.com/pingcap/tiup/components/errdoc/errdoc-gen +# YOU CAN CHANGE THE 'description'/'workaround' FIELDS IF THEM ARE IMPROPER. + +["admin:8003"] +error = ''' +TiDB admin check table failed. +''' + +["admin:8223"] +error = ''' +data isn't equal +''' + +["admin:8224"] +error = ''' +DDL Job:%v not found +''' + +["admin:8225"] +error = ''' +This job:%v is finished, so can't be cancelled +''' + +["admin:8226"] +error = ''' +This job:%v is almost finished, can't be cancelled now +''' + +["autoid:1075"] +error = ''' +Incorrect table definition; there can be only one auto column and it must be defined as a key +''' + +["autoid:1467"] +error = ''' +Failed to read auto-increment value from storage engine +''' + +["autoid:8058"] +error = ''' +Invalid allocator type +''' + +["autoid:8059"] +error = ''' +Failed to read auto-random value from storage engine +''' + +["ddl:1025"] +error = ''' +Error on rename of '%-.210s' to '%-.210s' (errno: %d - %s) +''' + +["ddl:1048"] +error = ''' +Column '%-.192s' cannot be null +''' + +["ddl:1054"] +error = ''' +Unknown column '%-.192s' in '%-.192s' +''' + +["ddl:1059"] +error = ''' +Identifier name '%-.100s' is too long +''' + +["ddl:1061"] +error = ''' +Duplicate key name '%-.192s' +''' + +["ddl:1067"] +error = ''' +Invalid default value for '%-.192s' +''' + +["ddl:1090"] +error = ''' +You can't delete all columns with ALTER TABLE; use DROP TABLE instead +''' + +["ddl:1091"] +error = ''' +Can't DROP '%-.192s'; check that column/key exists +''' + +["ddl:1102"] +error = ''' +Incorrect database name '%-.100s' +''' + +["ddl:1103"] +error = ''' +Incorrect table name '%-.100s' +''' + +["ddl:1111"] +error = ''' +Invalid use of group function +''' + +["ddl:1113"] +error = ''' +A table must have at least 1 column +''' + +["ddl:1115"] +error = ''' +Unknown character set: '%-.64s' +''' + +["ddl:1166"] +error = ''' +Incorrect column name '%-.100s' +''' + +["ddl:1171"] +error = ''' +All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead +''' + +["ddl:1177"] +error = ''' +Can't open table +''' + +["ddl:1214"] +error = ''' +The used table type doesn't support FULLTEXT indexes +''' + +["ddl:1248"] +error = ''' +Every derived table must have its own alias +''' + +["ddl:1253"] +error = ''' +COLLATION '%s' is not valid for CHARACTER SET '%s' +''' + +["ddl:1264"] +error = ''' +Out of range value for column '%s' at row %d +''' + +["ddl:1265"] +error = ''' +Data truncated for column '%s' at row %d +''' + +["ddl:1273"] +error = ''' +Unsupported collation when new collation is enabled: '%-.64s' +''' + +["ddl:1280"] +error = ''' +Incorrect index name '%-.100s' +''' + +["ddl:1292"] +error = ''' +Truncated incorrect %-.64s value: '%-.128s' +''' + +["ddl:1294"] +error = ''' +Invalid ON UPDATE clause for '%-.192s' column +''' + +["ddl:1302"] +error = ''' +Conflicting declarations: 'CHARACTER SET %s' and 'CHARACTER SET %s' +''' + +["ddl:1347"] +error = ''' +'%-.192s.%-.192s' is not %s +''' + +["ddl:1350"] +error = ''' +View's SELECT contains a '%s' clause +''' + +["ddl:1353"] +error = ''' +View's SELECT and view's field list have different column counts +''' + +["ddl:1481"] +error = ''' +MAXVALUE can only be used in last partition definition +''' + +["ddl:1488"] +error = ''' +Field in list of fields for partition function not found in table +''' + +["ddl:1491"] +error = ''' +The %-.192s function returns the wrong type +''' + +["ddl:1493"] +error = ''' +VALUES LESS THAN value must be strictly increasing for each partition +''' + +["ddl:1495"] +error = ''' +Multiple definition of same constant in list partitioning +''' + +["ddl:1499"] +error = ''' +Too many partitions (including subpartitions) were defined +''' + +["ddl:1503"] +error = ''' +A %-.192s must include all columns in the table's partitioning function +''' + +["ddl:1505"] +error = ''' +Partition management on a not partitioned table is not possible +''' + +["ddl:1507"] +error = ''' +Error in list of partitions to %-.64s +''' + +["ddl:1508"] +error = ''' +Cannot remove all partitions, use DROP TABLE instead +''' + +["ddl:1509"] +error = ''' +COALESCE PARTITION can only be used on HASH/KEY partitions +''' + +["ddl:1517"] +error = ''' +Duplicate partition name %-.192s +''' + +["ddl:1564"] +error = ''' +This partition function is not allowed +''' + +["ddl:1654"] +error = ''' +Partition column values of incorrect type +''' + +["ddl:1659"] +error = ''' +Field '%-.192s' is of a not allowed type for this type of partitioning +''' + +["ddl:1731"] +error = ''' +Non matching attribute '%-.64s' between partition and table +''' + +["ddl:1732"] +error = ''' +Table to exchange with partition is partitioned: '%-.64s' +''' + +["ddl:1736"] +error = ''' +Tables have different definitions +''' + +["ddl:1737"] +error = ''' +Found a row that does not match the partition +''' + +["ddl:1740"] +error = ''' +Table to exchange with partition has foreign key references: '%-.64s' +''' + +["ddl:1846"] +error = ''' +%s is not supported. Reason: %s. Try %s. +''' + +["ddl:3102"] +error = ''' +Expression of generated column '%s' contains a disallowed function. +''' + +["ddl:3106"] +error = ''' +'%s' is not supported for generated columns. +''' + +["ddl:3109"] +error = ''' +Generated column '%s' cannot refer to auto-increment column. +''' + +["ddl:3505"] +error = ''' +Too long enumeration/set value for column %s. +''' + +["ddl:3522"] +error = ''' +A primary key index cannot be invisible +''' + +["ddl:3754"] +error = ''' +Expression index '%s' cannot refer to an auto-increment column +''' + +["ddl:3756"] +error = ''' +The primary key cannot be an expression index +''' + +["ddl:3758"] +error = ''' +Expression of expression index '%s' contains a disallowed function +''' + +["ddl:3762"] +error = ''' +Expression index on a column is not supported. Consider using a regular index instead +''' + +["ddl:3764"] +error = ''' +Expression of generated column '%s' cannot refer to a row value +''' + +["ddl:3800"] +error = ''' +Expression of expression index '%s' cannot refer to a row value +''' + +["ddl:4135"] +error = ''' +Sequence '%-.64s.%-.64s' has run out +''' + +["ddl:4136"] +error = ''' +Sequence '%-.64s.%-.64s' values are conflicting +''' + +["ddl:4137"] +error = ''' +Sequence '%-.64s.%-.64s' access error +''' + +["ddl:4138"] +error = ''' +'%-.64s.%-.64s' is not a SEQUENCE +''' + +["ddl:4139"] +error = ''' +Unknown SEQUENCE: '%-.300s' +''' + +["ddl:8200"] +error = ''' +Unsupported partition by range columns +''' + +["ddl:8210"] +error = ''' +Invalid %!s(MISSING) state: %!v(MISSING) +''' + +["ddl:8215"] +error = ''' +Failed to repair table: %s +''' + +["ddl:8216"] +error = ''' +Invalid auto random: %s +''' + +["ddl:8227"] +error = ''' +Unsupported sequence table-option %s +''' + +["ddl:8228"] +error = ''' +Unsupported sequence default value for column type '%s' +''' + +["ddl:8230"] +error = ''' +Unsupported using sequence as default value in add column '%s' +''' + +["ddl:8231"] +error = ''' +%s is not supported +''' + +["ddl:8232"] +error = ''' +CREATE/ALTER table with union option is not supported +''' + +["ddl:8233"] +error = ''' +CREATE/ALTER table with insert method option is not supported +''' + +["ddl:8234"] +error = ''' +Invalid placement policy '%s': %s +''' + +["domain:8027"] +error = ''' +Information schema is out of date: schema failed to update in 1 lease, please make sure TiDB can connect to TiKV +''' + +["domain:8028"] +error = ''' +Information schema is changed during the execution of the statement(for example, table definition may be updated by other DDL ran in parallel). If you see this error often, try increasing `tidb_max_delta_schema_count`. [try again later] +''' + +["domain:9009"] +error = ''' +Prometheus address is not set in PD and etcd +''' + +["executor:1044"] +error = ''' +Access denied for user '%-.48s'@'%-.64s' to database '%-.192s' +''' + +["executor:1049"] +error = ''' +Unknown database '%-.192s' +''' + +["executor:1133"] +error = ''' +Can't find any matching row in the user table +''' + +["executor:1142"] +error = ''' +%-.128s command denied to user '%-.48s'@'%-.64s' for table '%-.64s' +''' + +["executor:1213"] +error = ''' +Deadlock found when trying to get lock; try restarting transaction +''' + +["executor:1317"] +error = ''' +Query execution was interrupted +''' + +["executor:1347"] +error = ''' +'%-.192s.%-.192s' is not %s +''' + +["executor:1390"] +error = ''' +Prepared statement contains too many placeholders +''' + +["executor:1396"] +error = ''' +Operation %s failed for %.256s +''' + +["executor:1410"] +error = ''' +You are not allowed to create a user with GRANT +''' + +["executor:1568"] +error = ''' +Transaction characteristics can't be changed while a transaction is in progress +''' + +["executor:1827"] +error = ''' +The password hash doesn't have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function. +''' + +["executor:8003"] +error = ''' +TiDB admin check table failed. +''' + +["executor:8114"] +error = ''' +Unknown plan +''' + +["executor:8115"] +error = ''' +Can not prepare multiple statements +''' + +["executor:8116"] +error = ''' +Can not prepare DDL statements with parameters +''' + +["executor:8117"] +error = ''' +Result is empty +''' + +["executor:8118"] +error = ''' +Failed to build executor +''' + +["executor:8119"] +error = ''' +Batch insert failed, please clean the table and try again. +''' + +["executor:8120"] +error = ''' +Can not get start ts +''' + +["executor:8124"] +error = ''' +Backup failed: %s +''' + +["executor:8125"] +error = ''' +Restore failed: %s +''' + +["executor:8126"] +error = ''' +Import failed: %s +''' + +["executor:8127"] +error = ''' +Export failed: %s +''' + +["expression:1139"] +error = ''' +Got error '%-.64s' from regexp +''' + +["expression:1235"] +error = ''' +function %s has only noop implementation in tidb now, use tidb_enable_noop_functions to enable these functions +''' + +["expression:1241"] +error = ''' +Operand should contain %d column(s) +''' + +["expression:1260"] +error = ''' +Some rows were cut by GROUPCONCAT(%s) +''' + +["expression:1267"] +error = ''' +Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s' +''' + +["expression:1270"] +error = ''' +Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s' +''' + +["expression:1271"] +error = ''' +Illegal mix of collations for operation '%s' +''' + +["expression:1365"] +error = ''' +Division by 0 +''' + +["expression:1582"] +error = ''' +Incorrect parameter count in the call to native function '%-.192s' +''' + +["expression:3020"] +error = ''' +Invalid argument for logarithm +''' + +["expression:3064"] +error = ''' +Incorrect type for argument %s in function %s. +''' + +["json:3069"] +error = ''' +Invalid JSON data provided to function %s: %s +''' + +["json:3140"] +error = ''' +Invalid JSON text: %-.192s +''' + +["json:3143"] +error = ''' +Invalid JSON path expression %s. +''' + +["json:3149"] +error = ''' +In this situation, path expressions may not contain the * and ** tokens. +''' + +["json:3150"] +error = ''' +The second argument can only be either 'one' or 'all'. +''' + +["json:3158"] +error = ''' +JSON documents may not contain NULL member names. +''' + +["json:3165"] +error = ''' +A path expression is not a path to a cell in an array. +''' + +["json:8066"] +error = ''' +JSON_OBJECTAGG: unsupported second argument type %v +''' + +["kv:1062"] +error = ''' +Duplicate entry '%-.64s' for key '%-.192s' +''' + +["kv:8004"] +error = ''' +Transaction is too large, size: %d +''' + +["kv:8005"] +error = ''' +Write conflict, txnStartTS %d is stale [try again later] +''' + +["kv:8021"] +error = ''' +Error: key not exist +''' + +["kv:8022"] +error = ''' +Error: KV error safe to retry %s [try again later] +''' + +["kv:8023"] +error = ''' +can not set nil value +''' + +["kv:8024"] +error = ''' +invalid transaction +''' + +["kv:8025"] +error = ''' +entry too large, the max entry size is %d, the size of data is %d +''' + +["kv:8026"] +error = ''' +not implemented +''' + +["kv:9007"] +error = ''' +Write conflict, txnStartTS=%d, conflictStartTS=%d, conflictCommitTS=%d, key=%s [try again later] +''' + +["meta:1007"] +error = ''' +Can't create database '%-.192s'; database exists +''' + +["meta:1049"] +error = ''' +Unknown database '%-.192s' +''' + +["meta:1050"] +error = ''' +Table '%-.192s' already exists +''' + +["meta:1146"] +error = ''' +Table '%-.192s.%-.192s' doesn't exist +''' + +["meta:8235"] +error = ''' +DDL reorg element does not exist +''' + +["planner:1044"] +error = ''' +Access denied for user '%-.48s'@'%-.64s' to database '%-.192s' +''' + +["planner:1045"] +error = ''' +Access denied for user '%-.48s'@'%-.64s' +''' + +["planner:1046"] +error = ''' +No database selected +''' + +["planner:1051"] +error = ''' +Unknown table '%-.100s' +''' + +["planner:1052"] +error = ''' +Column '%-.192s' in %-.192s is ambiguous +''' + +["planner:1054"] +error = ''' +Unknown column '%-.192s' in '%-.192s' +''' + +["planner:1055"] +error = ''' +Expression #%d of %s is not in GROUP BY clause and contains nonaggregated column '%s' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by +''' + +["planner:1056"] +error = ''' +Can't group on '%-.192s' +''' + +["planner:1060"] +error = ''' +Duplicate column name '%-.192s' +''' + +["planner:1066"] +error = ''' +Not unique table/alias: '%-.192s' +''' + +["planner:1094"] +error = ''' +Unknown thread id: %d +''' + +["planner:1105"] +error = ''' +Unknown error +''' + +["planner:1109"] +error = ''' +Unknown table '%-.192s' in %-.32s +''' + +["planner:1111"] +error = ''' +Invalid use of group function +''' + +["planner:1136"] +error = ''' +Column count doesn't match value count at row %d +''' + +["planner:1142"] +error = ''' +%-.128s command denied to user '%-.48s'@'%-.64s' for table '%-.64s' +''' + +["planner:1146"] +error = ''' +Table '%-.192s.%-.192s' doesn't exist +''' + +["planner:1176"] +error = ''' +Key '%-.192s' doesn't exist in table '%-.192s' +''' + +["planner:1210"] +error = ''' +Incorrect arguments to %s +''' + +["planner:1221"] +error = ''' +Incorrect usage of %s and %s +''' + +["planner:1222"] +error = ''' +The used SELECT statements have a different number of columns +''' + +["planner:1227"] +error = ''' +Access denied; you need (at least one of) the %-.128s privilege(s) for this operation +''' + +["planner:1235"] +error = ''' +This version of TiDB doesn't yet support '%s' +''' + +["planner:1241"] +error = ''' +Operand should contain %d column(s) +''' + +["planner:1247"] +error = ''' +Reference '%-.64s' not supported (%s) +''' + +["planner:1250"] +error = ''' +Table '%s' from one of the %ss cannot be used in %s +''' + +["planner:1288"] +error = ''' +The target table %-.100s of the %s is not updatable +''' + +["planner:1345"] +error = ''' +EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +''' + +["planner:1356"] +error = ''' +View '%-.192s.%-.192s' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +''' + +["planner:1462"] +error = ''' +`%-.192s`.`%-.192s` contains view recursion +''' + +["planner:1747"] +error = ''' +PARTITION () clause on non partitioned table +''' + +["planner:1791"] +error = ''' +Unknown EXPLAIN format name: '%s' +''' + +["planner:1815"] +error = ''' +Internal : %s +''' + +["planner:3105"] +error = ''' +The value specified for generated column '%s' in table '%s' is not allowed. +''' + +["planner:3106"] +error = ''' +'%s' is not supported for generated columns. +''' + +["planner:3126"] +error = ''' +Hint %s is ignored as conflicting/duplicated. +''' + +["planner:3128"] +error = ''' +Unresolved name '%s' for %s hint +''' + +["planner:3579"] +error = ''' +Window name '%s' is not defined. +''' + +["planner:3580"] +error = ''' +There is a circularity in the window dependency graph. +''' + +["planner:3581"] +error = ''' +A window which depends on another cannot define partitioning. +''' + +["planner:3582"] +error = ''' +Window '%s' has a frame definition, so cannot be referenced by another window. +''' + +["planner:3583"] +error = ''' +Window '%s' cannot inherit '%s' since both contain an ORDER BY clause. +''' + +["planner:3584"] +error = ''' +Window '%s': frame start cannot be UNBOUNDED FOLLOWING. +''' + +["planner:3585"] +error = ''' +Window '%s': frame end cannot be UNBOUNDED PRECEDING. +''' + +["planner:3586"] +error = ''' +Window '%s': frame start or end is negative, NULL or of non-integral type +''' + +["planner:3587"] +error = ''' +Window '%s' with RANGE N PRECEDING/FOLLOWING frame requires exactly one ORDER BY expression, of numeric or temporal type +''' + +["planner:3588"] +error = ''' +Window '%s' with RANGE frame has ORDER BY expression of datetime type. Only INTERVAL bound value allowed. +''' + +["planner:3589"] +error = ''' +Window '%s' with RANGE frame has ORDER BY expression of numeric type, INTERVAL bound value not allowed. +''' + +["planner:3590"] +error = ''' +Window '%s' has a non-constant frame bound. +''' + +["planner:3591"] +error = ''' +Window '%s' is defined twice. +''' + +["planner:3593"] +error = ''' +You cannot use the window function '%s' in this context.' +''' + +["planner:3594"] +error = ''' +You cannot use the alias '%s' of an expression containing a window function in this context.' +''' + +["planner:3596"] +error = ''' +Window '%s': INTERVAL can only be used with RANGE frames. +''' + +["planner:3599"] +error = ''' +Window function '%s' ignores the frame clause of window '%s' and aggregates over the whole partition +''' + +["planner:3637"] +error = ''' +Variable '%s' cannot be set using SET_VAR hint. +''' + +["planner:8108"] +error = ''' +Unsupported type %T +''' + +["planner:8109"] +error = ''' +Index '%s' in field list does not exist in table '%s' +''' + +["planner:8110"] +error = ''' +Cartesian product is unsupported +''' + +["planner:8111"] +error = ''' +Prepared statement not found +''' + +["planner:8112"] +error = ''' +Wrong parameter count +''' + +["planner:8113"] +error = ''' +Schema has changed +''' + +["planner:8121"] +error = ''' +privilege check fail +''' + +["planner:8122"] +error = ''' +Wildcard fields without any table name appears in wrong place +''' + +["planner:8123"] +error = ''' +In aggregated query without GROUP BY, expression #%d of SELECT list contains nonaggregated column '%s'; this is incompatible with sql_mode=only_full_group_by +''' + +["privilege:1141"] +error = ''' +There is no such grant defined for user '%-.48s' on host '%-.64s' +''' + +["privilege:3530"] +error = ''' +%s is is not granted to %s +''' + +["schema:1007"] +error = ''' +Can't create database '%-.192s'; database exists +''' + +["schema:1008"] +error = ''' +Can't drop database '%-.192s'; database doesn't exist +''' + +["schema:1045"] +error = ''' +Access denied for user '%-.48s'@'%-.64s' (using password: %s) +''' + +["schema:1049"] +error = ''' +Unknown database '%-.192s' +''' + +["schema:1050"] +error = ''' +Table '%-.192s' already exists +''' + +["schema:1051"] +error = ''' +Unknown table '%-.100s' +''' + +["schema:1054"] +error = ''' +Unknown column '%-.192s' in '%-.192s' +''' + +["schema:1060"] +error = ''' +Duplicate column name '%-.192s' +''' + +["schema:1061"] +error = ''' +Duplicate key name '%-.192s' +''' + +["schema:1066"] +error = ''' +Not unique table/alias: '%-.192s' +''' + +["schema:1068"] +error = ''' +Multiple primary key defined +''' + +["schema:1070"] +error = ''' +Too many key parts specified; max %d parts allowed +''' + +["schema:1091"] +error = ''' +Can't DROP '%-.192s'; check that column/key exists +''' + +["schema:1099"] +error = ''' +Table '%-.192s' was locked with a READ lock and can't be updated +''' + +["schema:1100"] +error = ''' +Table '%-.192s' was not locked with LOCK TABLES +''' + +["schema:1146"] +error = ''' +Table '%-.192s.%-.192s' doesn't exist +''' + +["schema:1176"] +error = ''' +Key '%-.192s' doesn't exist in table '%-.192s' +''' + +["schema:1215"] +error = ''' +Cannot add foreign key constraint +''' + +["schema:1239"] +error = ''' +Incorrect foreign key definition for '%-.192s': %s +''' + +["schema:1347"] +error = ''' +'%-.192s.%-.192s' is not %s +''' + +["schema:1831"] +error = ''' +Duplicate index '%-.64s' defined on the table '%-.64s.%-.64s'. This is deprecated and will be disallowed in a future release. +''' + +["schema:3162"] +error = ''' +User %s does not exist. +''' + +["schema:3163"] +error = ''' +User %s already exists. +''' + +["schema:4139"] +error = ''' +Unknown SEQUENCE: '%-.300s' +''' + +["schema:8020"] +error = ''' +Table '%s' was locked in %s by %v +''' + +["session:8002"] +error = ''' +[%d] can not retry select for update statement +''' + +["structure:8217"] +error = ''' +invalid encoded hash key flag +''' + +["structure:8218"] +error = ''' +invalid list index +''' + +["structure:8219"] +error = ''' +invalid list meta data +''' + +["structure:8220"] +error = ''' +write on snapshot +''' + +["table:1048"] +error = ''' +Column '%-.192s' cannot be null +''' + +["table:1054"] +error = ''' +Unknown column '%-.192s' in '%-.192s' +''' + +["table:1192"] +error = ''' +Can't execute the given command because you have active locked tables or an active transaction +''' + +["table:1364"] +error = ''' +Field '%-.192s' doesn't have a default value +''' + +["table:1366"] +error = ''' +Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %d +''' + +["table:1526"] +error = ''' +Table has no partition for value %-.64s +''' + +["table:1735"] +error = ''' +Unknown partition '%-.64s' in table '%-.64s' +''' + +["table:1748"] +error = ''' +Found a row not matching the given partition set +''' + +["table:4135"] +error = ''' +Sequence '%-.64s.%-.64s' has run out +''' + +["table:8039"] +error = ''' +Index column %s offset out of bound, offset: %d, row: %v +''' + +["table:8040"] +error = ''' +operation not supported +''' + +["table:8041"] +error = ''' +can not find the row: %s +''' + +["table:8042"] +error = ''' +table %s can't be in none state +''' + +["table:8043"] +error = ''' +can not use non-public column +''' + +["table:8044"] +error = ''' +index %s can't be in none state +''' + +["table:8045"] +error = ''' +invalid record key +''' + +["table:8046"] +error = ''' +column %s can't be in none state +''' + +["tikv:1105"] +error = ''' +Unknown error +''' + +["tikv:1205"] +error = ''' +Lock wait timeout exceeded; try restarting transaction +''' + +["tikv:1317"] +error = ''' +Query execution was interrupted +''' + +["tikv:3572"] +error = ''' +Statement aborted because lock(s) could not be acquired immediately and NOWAIT is set. +''' + +["tikv:8229"] +error = ''' +TTL manager has timed out, pessimistic locks may expire, please commit or rollback this transaction +''' + +["tikv:9001"] +error = ''' +PD server timeout +''' + +["tikv:9002"] +error = ''' +TiKV server timeout +''' + +["tikv:9003"] +error = ''' +TiKV server is busy +''' + +["tikv:9004"] +error = ''' +Resolve lock timeout +''' + +["tikv:9005"] +error = ''' +Region is unavailable +''' + +["tikv:9006"] +error = ''' +GC life time is shorter than transaction duration, transaction starts at %v, GC safe point is %v +''' + +["tikv:9008"] +error = ''' +Store token is up to the limit, store id = %d +''' + +["tikv:9010"] +error = ''' +TiKV server reports stale command +''' + +["tikv:9011"] +error = ''' +TiKV max timestamp is not synced +''' + +["types:1074"] +error = ''' +Column length too big for column '%-.192s' (max = %d); use BLOB or TEXT instead +''' + +["types:1097"] +error = ''' +Too many strings for column %-.192s and SET +''' + +["types:1264"] +error = ''' +Out of range value for column '%s' at row %d +''' + +["types:1265"] +error = ''' +Data truncated for column '%s' at row %d +''' + +["types:1291"] +error = ''' +Column '%-.100s' has duplicated value '%-.64s' in %s +''' + +["types:1292"] +error = ''' +Truncated incorrect %-.64s value: '%-.128s' +''' + +["types:1365"] +error = ''' +Division by 0 +''' + +["types:1367"] +error = ''' +Illegal %s '%-.192s' value found during parsing +''' + +["types:1406"] +error = ''' +Data too long for column '%s' at row %d +''' + +["types:1411"] +error = ''' +Incorrect %-.32s value: '%-.128s' for function %-.32s +''' + +["types:1425"] +error = ''' +Too big scale %d specified for column '%-.192s'. Maximum is %d. +''' + +["types:1426"] +error = ''' +Too big precision %d specified for column '%-.192s'. Maximum is %d. +''' + +["types:1427"] +error = ''' +For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.192s'). +''' + +["types:1439"] +error = ''' +Display width out of range for column '%-.192s' (max = %d) +''' + +["types:1441"] +error = ''' +Datetime function: %-.32s field overflow +''' + +["types:1690"] +error = ''' +%s value is out of range in '%s' +''' + +["types:3013"] +error = ''' +Invalid size for column '%s'. +''' + +["types:8029"] +error = ''' +Bad Number +''' + +["types:8030"] +error = ''' +Cast to signed converted positive out-of-range integer to it's negative complement +''' + +["types:8031"] +error = ''' +Cast to unsigned converted negative integer to it's positive complement +''' + +["types:8032"] +error = ''' +invalid year format +''' + +["types:8033"] +error = ''' +invalid year +''' + +["types:8037"] +error = ''' +invalid week mode format: '%v' +''' + +["variable:1193"] +error = ''' +Unknown system variable '%-.64s' +''' + +["variable:1231"] +error = ''' +Variable '%-.64s' can't be set to the value of '%-.200s' +''' + +["variable:1232"] +error = ''' +Incorrect argument type to variable '%-.64s' +''' + +["variable:1238"] +error = ''' +Variable '%-.192s' is a %s variable +''' + +["variable:1292"] +error = ''' +Truncated incorrect %-.64s value: '%-.128s' +''' + +["variable:1298"] +error = ''' +Unknown or incorrect time zone: '%-.64s' +''' + +["variable:1461"] +error = ''' +Can't create more than maxPreparedStmtCount statements (current value: %d) +''' + +["variable:1621"] +error = ''' +%s variable '%s' is read-only. Use SET %s to assign the value +''' + +["variable:8047"] +error = ''' +variable '%s' does not yet support value: %s +''' + +["variable:8048"] +error = ''' +The isolation level '%s' is not supported. Set tidb_skip_isolation_level_check=1 to skip this error +''' + +["variable:8055"] +error = ''' +snapshot is older than GC safe point %s +''' + diff --git a/executor/ddl_test.go b/executor/ddl_test.go index f5b22e47876a2..9aa769098a6e9 100644 --- a/executor/ddl_test.go +++ b/executor/ddl_test.go @@ -287,7 +287,24 @@ func (s *testSuite3) TestCreateView(c *C) { c.Assert(err.Error(), Equals, "update view v_issue_16253 is not supported now.") } +<<<<<<< HEAD func (s *testSuite3) TestIssue16250(c *C) { +======= +func (s *testSuite6) TestViewRecursion(c *C) { + tk := testkit.NewTestKit(c, s.store) + tk.MustExec("use test") + tk.MustExec("create table if not exists t(a int)") + tk.MustExec("create definer='root'@'localhost' view recursive_view1 as select * from t") + tk.MustExec("create definer='root'@'localhost' view recursive_view2 as select * from recursive_view1") + tk.MustExec("drop table t") + tk.MustExec("rename table recursive_view2 to t") + _, err := tk.Exec("select * from recursive_view1") + c.Assert(terror.ErrorEqual(err, plannercore.ErrViewRecursive), IsTrue) + tk.MustExec("drop view recursive_view1, t") +} + +func (s *testSuite6) TestIssue16250(c *C) { +>>>>>>> f81a5d131... planner: check view recursion when building source from view (#20398) tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("create table if not exists t(a int)") diff --git a/planner/core/errors.go b/planner/core/errors.go index a8af76b340aa1..6ab6ef4b9df08 100644 --- a/planner/core/errors.go +++ b/planner/core/errors.go @@ -81,6 +81,7 @@ const ( // error definitions. var ( +<<<<<<< HEAD ErrUnsupportedType = terror.ClassOptimizer.New(codeUnsupportedType, "Unsupported type %T") ErrAnalyzeMissIndex = terror.ClassOptimizer.New(codeAnalyzeMissIndex, "Index '%s' in field list does not exist in table '%s'") ErrCartesianProductUnsupported = terror.ClassOptimizer.New(codeUnsupported, "Cartesian product is unsupported") @@ -144,6 +145,74 @@ var ( ErrNoSuchThread = terror.ClassOptimizer.New(mysql.ErrNoSuchThread, mysql.MySQLErrName[mysql.ErrNoSuchThread]) // Since we cannot know if user loggined with a password, use message of ErrAccessDeniedNoPassword instead ErrAccessDenied = terror.ClassOptimizer.New(mysql.ErrAccessDenied, mysql.MySQLErrName[mysql.ErrAccessDeniedNoPassword]) +======= + ErrUnsupportedType = dbterror.ClassOptimizer.NewStd(mysql.ErrUnsupportedType) + ErrAnalyzeMissIndex = dbterror.ClassOptimizer.NewStd(mysql.ErrAnalyzeMissIndex) + ErrWrongParamCount = dbterror.ClassOptimizer.NewStd(mysql.ErrWrongParamCount) + ErrSchemaChanged = dbterror.ClassOptimizer.NewStd(mysql.ErrSchemaChanged) + ErrTablenameNotAllowedHere = dbterror.ClassOptimizer.NewStd(mysql.ErrTablenameNotAllowedHere) + ErrNotSupportedYet = dbterror.ClassOptimizer.NewStd(mysql.ErrNotSupportedYet) + ErrWrongUsage = dbterror.ClassOptimizer.NewStd(mysql.ErrWrongUsage) + ErrUnknown = dbterror.ClassOptimizer.NewStd(mysql.ErrUnknown) + ErrUnknownTable = dbterror.ClassOptimizer.NewStd(mysql.ErrUnknownTable) + ErrNoSuchTable = dbterror.ClassOptimizer.NewStd(mysql.ErrNoSuchTable) + ErrViewRecursive = dbterror.ClassOptimizer.NewStd(mysql.ErrViewRecursive) + ErrWrongArguments = dbterror.ClassOptimizer.NewStd(mysql.ErrWrongArguments) + ErrWrongNumberOfColumnsInSelect = dbterror.ClassOptimizer.NewStd(mysql.ErrWrongNumberOfColumnsInSelect) + ErrBadGeneratedColumn = dbterror.ClassOptimizer.NewStd(mysql.ErrBadGeneratedColumn) + ErrFieldNotInGroupBy = dbterror.ClassOptimizer.NewStd(mysql.ErrFieldNotInGroupBy) + ErrBadTable = dbterror.ClassOptimizer.NewStd(mysql.ErrBadTable) + ErrKeyDoesNotExist = dbterror.ClassOptimizer.NewStd(mysql.ErrKeyDoesNotExist) + ErrOperandColumns = dbterror.ClassOptimizer.NewStd(mysql.ErrOperandColumns) + ErrInvalidGroupFuncUse = dbterror.ClassOptimizer.NewStd(mysql.ErrInvalidGroupFuncUse) + ErrIllegalReference = dbterror.ClassOptimizer.NewStd(mysql.ErrIllegalReference) + ErrNoDB = dbterror.ClassOptimizer.NewStd(mysql.ErrNoDB) + ErrUnknownExplainFormat = dbterror.ClassOptimizer.NewStd(mysql.ErrUnknownExplainFormat) + ErrWrongGroupField = dbterror.ClassOptimizer.NewStd(mysql.ErrWrongGroupField) + ErrDupFieldName = dbterror.ClassOptimizer.NewStd(mysql.ErrDupFieldName) + ErrNonUpdatableTable = dbterror.ClassOptimizer.NewStd(mysql.ErrNonUpdatableTable) + ErrInternal = dbterror.ClassOptimizer.NewStd(mysql.ErrInternal) + ErrNonUniqTable = dbterror.ClassOptimizer.NewStd(mysql.ErrNonuniqTable) + ErrWindowInvalidWindowFuncUse = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowInvalidWindowFuncUse) + ErrWindowInvalidWindowFuncAliasUse = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowInvalidWindowFuncAliasUse) + ErrWindowNoSuchWindow = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowNoSuchWindow) + ErrWindowCircularityInWindowGraph = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowCircularityInWindowGraph) + ErrWindowNoChildPartitioning = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowNoChildPartitioning) + ErrWindowNoInherentFrame = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowNoInherentFrame) + ErrWindowNoRedefineOrderBy = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowNoRedefineOrderBy) + ErrWindowDuplicateName = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowDuplicateName) + ErrPartitionClauseOnNonpartitioned = dbterror.ClassOptimizer.NewStd(mysql.ErrPartitionClauseOnNonpartitioned) + ErrWindowFrameStartIllegal = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowFrameStartIllegal) + ErrWindowFrameEndIllegal = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowFrameEndIllegal) + ErrWindowFrameIllegal = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowFrameIllegal) + ErrWindowRangeFrameOrderType = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowRangeFrameOrderType) + ErrWindowRangeFrameTemporalType = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowRangeFrameTemporalType) + ErrWindowRangeFrameNumericType = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowRangeFrameNumericType) + ErrWindowRangeBoundNotConstant = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowRangeBoundNotConstant) + ErrWindowRowsIntervalUse = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowRowsIntervalUse) + ErrWindowFunctionIgnoresFrame = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowFunctionIgnoresFrame) + ErrUnsupportedOnGeneratedColumn = dbterror.ClassOptimizer.NewStd(mysql.ErrUnsupportedOnGeneratedColumn) + ErrPrivilegeCheckFail = dbterror.ClassOptimizer.NewStd(mysql.ErrPrivilegeCheckFail) + ErrInvalidWildCard = dbterror.ClassOptimizer.NewStd(mysql.ErrInvalidWildCard) + ErrMixOfGroupFuncAndFields = dbterror.ClassOptimizer.NewStd(mysql.ErrMixOfGroupFuncAndFieldsIncompatible) + errTooBigPrecision = dbterror.ClassExpression.NewStd(mysql.ErrTooBigPrecision) + ErrDBaccessDenied = dbterror.ClassOptimizer.NewStd(mysql.ErrDBaccessDenied) + ErrTableaccessDenied = dbterror.ClassOptimizer.NewStd(mysql.ErrTableaccessDenied) + ErrSpecificAccessDenied = dbterror.ClassOptimizer.NewStd(mysql.ErrSpecificAccessDenied) + ErrViewNoExplain = dbterror.ClassOptimizer.NewStd(mysql.ErrViewNoExplain) + ErrWrongValueCountOnRow = dbterror.ClassOptimizer.NewStd(mysql.ErrWrongValueCountOnRow) + ErrViewInvalid = dbterror.ClassOptimizer.NewStd(mysql.ErrViewInvalid) + ErrNoSuchThread = dbterror.ClassOptimizer.NewStd(mysql.ErrNoSuchThread) + ErrUnknownColumn = dbterror.ClassOptimizer.NewStd(mysql.ErrBadField) + ErrCartesianProductUnsupported = dbterror.ClassOptimizer.NewStd(mysql.ErrCartesianProductUnsupported) + ErrStmtNotFound = dbterror.ClassOptimizer.NewStd(mysql.ErrPreparedStmtNotFound) + ErrAmbiguous = dbterror.ClassOptimizer.NewStd(mysql.ErrNonUniq) + ErrUnresolvedHintName = dbterror.ClassOptimizer.NewStd(mysql.ErrUnresolvedHintName) + ErrNotHintUpdatable = dbterror.ClassOptimizer.NewStd(mysql.ErrNotHintUpdatable) + ErrWarnConflictingHint = dbterror.ClassOptimizer.NewStd(mysql.ErrWarnConflictingHint) + // Since we cannot know if user logged in with a password, use message of ErrAccessDeniedNoPassword instead + ErrAccessDenied = dbterror.ClassOptimizer.NewStdErr(mysql.ErrAccessDenied, mysql.MySQLErrName[mysql.ErrAccessDeniedNoPassword]) +>>>>>>> f81a5d131... planner: check view recursion when building source from view (#20398) ) func init() { diff --git a/planner/core/logical_plan_builder.go b/planner/core/logical_plan_builder.go index 53c1c36907090..f9148d42948e3 100644 --- a/planner/core/logical_plan_builder.go +++ b/planner/core/logical_plan_builder.go @@ -32,6 +32,7 @@ import ( "github.com/pingcap/parser/model" "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/opcode" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" @@ -48,6 +49,7 @@ import ( driver "github.com/pingcap/tidb/types/parser_driver" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/plancodec" + "github.com/pingcap/tidb/util/set" ) const ( @@ -2313,9 +2315,6 @@ func (b *PlanBuilder) buildDataSource(ctx context.Context, tn *ast.TableName) (L b.visitInfo = appendVisitInfo(b.visitInfo, mysql.SelectPriv, dbName.L, tableInfo.Name.L, "", authErr) if tableInfo.IsView() { - if b.capFlag&collectUnderlyingViewName != 0 { - b.underlyingViewNames.Insert(dbName.L + "." + tn.Name.L) - } return b.BuildDataSourceFromView(ctx, dbName, tableInfo) } @@ -2431,8 +2430,33 @@ func (b *PlanBuilder) buildDataSource(ctx context.Context, tn *ast.TableName) (L return result, nil } +// checkRecursiveView checks whether this view is recursively defined. +func (b *PlanBuilder) checkRecursiveView(dbName model.CIStr, tableName model.CIStr) (func(), error) { + viewFullName := dbName.L + "." + tableName.L + if b.buildingViewStack == nil { + b.buildingViewStack = set.NewStringSet() + } + // If this view has already been on the building stack, it means + // this view contains a recursive definition. + if b.buildingViewStack.Exist(viewFullName) { + return nil, ErrViewRecursive.GenWithStackByArgs(dbName.O, tableName.O) + } + // If the view is being renamed, we return the mysql compatible error message. + if b.capFlag&renameView != 0 && viewFullName == b.renamingViewName { + return nil, ErrNoSuchTable.GenWithStackByArgs(dbName.O, tableName.O) + } + b.buildingViewStack.Insert(viewFullName) + return func() { delete(b.buildingViewStack, viewFullName) }, nil +} + // BuildDataSourceFromView is used to build LogicalPlan from view func (b *PlanBuilder) BuildDataSourceFromView(ctx context.Context, dbName model.CIStr, tableInfo *model.TableInfo) (LogicalPlan, error) { + deferFunc, err := b.checkRecursiveView(dbName, tableInfo.Name) + if err != nil { + return nil, err + } + defer deferFunc() + charset, collation := b.ctx.GetSessionVars().GetCharsetInfo() viewParser := parser.New() viewParser.EnableWindowFunc(b.ctx.GetSessionVars().EnableWindowFunction) @@ -2444,7 +2468,10 @@ func (b *PlanBuilder) BuildDataSourceFromView(ctx context.Context, dbName model. b.visitInfo = make([]visitInfo, 0) selectLogicalPlan, err := b.Build(ctx, selectNode) if err != nil { - err = ErrViewInvalid.GenWithStackByArgs(dbName.O, tableInfo.Name.O) + if terror.ErrorNotEqual(err, ErrViewRecursive) && + terror.ErrorNotEqual(err, ErrNoSuchTable) { + err = ErrViewInvalid.GenWithStackByArgs(dbName.O, tableInfo.Name.O) + } return nil, err } diff --git a/planner/core/planbuilder.go b/planner/core/planbuilder.go index 424a1efdb8738..434bba5cbe22e 100644 --- a/planner/core/planbuilder.go +++ b/planner/core/planbuilder.go @@ -170,9 +170,9 @@ const ( // canExpandAST indicates whether the origin AST can be expanded during plan // building. ONLY used for `CreateViewStmt` now. canExpandAST - // collectUnderlyingViewName indicates whether to collect the underlying - // view names of a CreateViewStmt during plan building. - collectUnderlyingViewName + // renameView indicates a view is being renamed, so we cannot use the origin + // definition of that view. + renameView ) // PlanBuilder builds Plan from an ast.Node. @@ -207,8 +207,62 @@ type PlanBuilder struct { // SelectLock need this information to locate the lock on partitions. partitionedTable []table.PartitionedTable +<<<<<<< HEAD // CreateView needs this information to check whether exists nested view. underlyingViewNames set.StringSet +======= + // buildingViewStack is used to check whether there is a recursive view. + buildingViewStack set.StringSet + // renamingViewName is the name of the view which is being renamed. + renamingViewName string + + // evalDefaultExpr needs this information to find the corresponding column. + // It stores the OutputNames before buildProjection. + allNames [][]*types.FieldName +} + +type handleColHelper struct { + id2HandleMapStack []map[int64][]HandleCols + stackTail int +} + +func (hch *handleColHelper) appendColToLastMap(tblID int64, handleCols HandleCols) { + tailMap := hch.id2HandleMapStack[hch.stackTail-1] + tailMap[tblID] = append(tailMap[tblID], handleCols) +} + +func (hch *handleColHelper) popMap() map[int64][]HandleCols { + ret := hch.id2HandleMapStack[hch.stackTail-1] + hch.stackTail-- + hch.id2HandleMapStack = hch.id2HandleMapStack[:hch.stackTail] + return ret +} + +func (hch *handleColHelper) pushMap(m map[int64][]HandleCols) { + hch.id2HandleMapStack = append(hch.id2HandleMapStack, m) + hch.stackTail++ +} + +func (hch *handleColHelper) mergeAndPush(m1, m2 map[int64][]HandleCols) { + newMap := make(map[int64][]HandleCols, mathutil.Max(len(m1), len(m2))) + for k, v := range m1 { + newMap[k] = make([]HandleCols, len(v)) + copy(newMap[k], v) + } + for k, v := range m2 { + if _, ok := newMap[k]; ok { + newMap[k] = append(newMap[k], v...) + } else { + newMap[k] = make([]HandleCols, len(v)) + copy(newMap[k], v) + } + } + hch.pushMap(newMap) +} + +func (hch *handleColHelper) tailMap() map[int64][]HandleCols { + return hch.id2HandleMapStack[hch.stackTail-1] +>>>>>>> f81a5d131... planner: check view recursion when building source from view (#20398) } // GetVisitInfo gets the visitInfo of the PlanBuilder. @@ -2225,20 +2279,16 @@ func (b *PlanBuilder) buildDDL(ctx context.Context, node ast.DDLNode) (Plan, err v.ReferTable.Name.L, "", authErr) } case *ast.CreateViewStmt: - b.capFlag |= canExpandAST - b.capFlag |= collectUnderlyingViewName + b.capFlag |= canExpandAST | renameView + b.renamingViewName = v.ViewName.Schema.L + "." + v.ViewName.Name.L defer func() { b.capFlag &= ^canExpandAST - b.capFlag &= ^collectUnderlyingViewName + b.capFlag &= ^renameView }() - b.underlyingViewNames = set.NewStringSet() plan, err := b.Build(ctx, v.Select) if err != nil { return nil, err } - if b.underlyingViewNames.Exist(v.ViewName.Schema.L + "." + v.ViewName.Name.L) { - return nil, ErrNoSuchTable.GenWithStackByArgs(v.ViewName.Schema.O, v.ViewName.Name.O) - } schema := plan.Schema() if v.Cols == nil { adjustOverlongViewColname(plan.(LogicalPlan)) From 21d35ca085b61088348bcd307aa5e3bf774c72bb Mon Sep 17 00:00:00 2001 From: mingconghan Date: Fri, 13 Nov 2020 15:22:39 +0800 Subject: [PATCH 2/2] resolve conflicts --- errors.toml | 1543 ----------------------------------- executor/ddl_test.go | 8 +- planner/core/errors.go | 70 +- planner/core/planbuilder.go | 53 +- 4 files changed, 4 insertions(+), 1670 deletions(-) delete mode 100644 errors.toml diff --git a/errors.toml b/errors.toml deleted file mode 100644 index cb673bd2b0611..0000000000000 --- a/errors.toml +++ /dev/null @@ -1,1543 +0,0 @@ -# AUTOGENERATED BY github.com/pingcap/tiup/components/errdoc/errdoc-gen -# YOU CAN CHANGE THE 'description'/'workaround' FIELDS IF THEM ARE IMPROPER. - -["admin:8003"] -error = ''' -TiDB admin check table failed. -''' - -["admin:8223"] -error = ''' -data isn't equal -''' - -["admin:8224"] -error = ''' -DDL Job:%v not found -''' - -["admin:8225"] -error = ''' -This job:%v is finished, so can't be cancelled -''' - -["admin:8226"] -error = ''' -This job:%v is almost finished, can't be cancelled now -''' - -["autoid:1075"] -error = ''' -Incorrect table definition; there can be only one auto column and it must be defined as a key -''' - -["autoid:1467"] -error = ''' -Failed to read auto-increment value from storage engine -''' - -["autoid:8058"] -error = ''' -Invalid allocator type -''' - -["autoid:8059"] -error = ''' -Failed to read auto-random value from storage engine -''' - -["ddl:1025"] -error = ''' -Error on rename of '%-.210s' to '%-.210s' (errno: %d - %s) -''' - -["ddl:1048"] -error = ''' -Column '%-.192s' cannot be null -''' - -["ddl:1054"] -error = ''' -Unknown column '%-.192s' in '%-.192s' -''' - -["ddl:1059"] -error = ''' -Identifier name '%-.100s' is too long -''' - -["ddl:1061"] -error = ''' -Duplicate key name '%-.192s' -''' - -["ddl:1067"] -error = ''' -Invalid default value for '%-.192s' -''' - -["ddl:1090"] -error = ''' -You can't delete all columns with ALTER TABLE; use DROP TABLE instead -''' - -["ddl:1091"] -error = ''' -Can't DROP '%-.192s'; check that column/key exists -''' - -["ddl:1102"] -error = ''' -Incorrect database name '%-.100s' -''' - -["ddl:1103"] -error = ''' -Incorrect table name '%-.100s' -''' - -["ddl:1111"] -error = ''' -Invalid use of group function -''' - -["ddl:1113"] -error = ''' -A table must have at least 1 column -''' - -["ddl:1115"] -error = ''' -Unknown character set: '%-.64s' -''' - -["ddl:1166"] -error = ''' -Incorrect column name '%-.100s' -''' - -["ddl:1171"] -error = ''' -All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead -''' - -["ddl:1177"] -error = ''' -Can't open table -''' - -["ddl:1214"] -error = ''' -The used table type doesn't support FULLTEXT indexes -''' - -["ddl:1248"] -error = ''' -Every derived table must have its own alias -''' - -["ddl:1253"] -error = ''' -COLLATION '%s' is not valid for CHARACTER SET '%s' -''' - -["ddl:1264"] -error = ''' -Out of range value for column '%s' at row %d -''' - -["ddl:1265"] -error = ''' -Data truncated for column '%s' at row %d -''' - -["ddl:1273"] -error = ''' -Unsupported collation when new collation is enabled: '%-.64s' -''' - -["ddl:1280"] -error = ''' -Incorrect index name '%-.100s' -''' - -["ddl:1292"] -error = ''' -Truncated incorrect %-.64s value: '%-.128s' -''' - -["ddl:1294"] -error = ''' -Invalid ON UPDATE clause for '%-.192s' column -''' - -["ddl:1302"] -error = ''' -Conflicting declarations: 'CHARACTER SET %s' and 'CHARACTER SET %s' -''' - -["ddl:1347"] -error = ''' -'%-.192s.%-.192s' is not %s -''' - -["ddl:1350"] -error = ''' -View's SELECT contains a '%s' clause -''' - -["ddl:1353"] -error = ''' -View's SELECT and view's field list have different column counts -''' - -["ddl:1481"] -error = ''' -MAXVALUE can only be used in last partition definition -''' - -["ddl:1488"] -error = ''' -Field in list of fields for partition function not found in table -''' - -["ddl:1491"] -error = ''' -The %-.192s function returns the wrong type -''' - -["ddl:1493"] -error = ''' -VALUES LESS THAN value must be strictly increasing for each partition -''' - -["ddl:1495"] -error = ''' -Multiple definition of same constant in list partitioning -''' - -["ddl:1499"] -error = ''' -Too many partitions (including subpartitions) were defined -''' - -["ddl:1503"] -error = ''' -A %-.192s must include all columns in the table's partitioning function -''' - -["ddl:1505"] -error = ''' -Partition management on a not partitioned table is not possible -''' - -["ddl:1507"] -error = ''' -Error in list of partitions to %-.64s -''' - -["ddl:1508"] -error = ''' -Cannot remove all partitions, use DROP TABLE instead -''' - -["ddl:1509"] -error = ''' -COALESCE PARTITION can only be used on HASH/KEY partitions -''' - -["ddl:1517"] -error = ''' -Duplicate partition name %-.192s -''' - -["ddl:1564"] -error = ''' -This partition function is not allowed -''' - -["ddl:1654"] -error = ''' -Partition column values of incorrect type -''' - -["ddl:1659"] -error = ''' -Field '%-.192s' is of a not allowed type for this type of partitioning -''' - -["ddl:1731"] -error = ''' -Non matching attribute '%-.64s' between partition and table -''' - -["ddl:1732"] -error = ''' -Table to exchange with partition is partitioned: '%-.64s' -''' - -["ddl:1736"] -error = ''' -Tables have different definitions -''' - -["ddl:1737"] -error = ''' -Found a row that does not match the partition -''' - -["ddl:1740"] -error = ''' -Table to exchange with partition has foreign key references: '%-.64s' -''' - -["ddl:1846"] -error = ''' -%s is not supported. Reason: %s. Try %s. -''' - -["ddl:3102"] -error = ''' -Expression of generated column '%s' contains a disallowed function. -''' - -["ddl:3106"] -error = ''' -'%s' is not supported for generated columns. -''' - -["ddl:3109"] -error = ''' -Generated column '%s' cannot refer to auto-increment column. -''' - -["ddl:3505"] -error = ''' -Too long enumeration/set value for column %s. -''' - -["ddl:3522"] -error = ''' -A primary key index cannot be invisible -''' - -["ddl:3754"] -error = ''' -Expression index '%s' cannot refer to an auto-increment column -''' - -["ddl:3756"] -error = ''' -The primary key cannot be an expression index -''' - -["ddl:3758"] -error = ''' -Expression of expression index '%s' contains a disallowed function -''' - -["ddl:3762"] -error = ''' -Expression index on a column is not supported. Consider using a regular index instead -''' - -["ddl:3764"] -error = ''' -Expression of generated column '%s' cannot refer to a row value -''' - -["ddl:3800"] -error = ''' -Expression of expression index '%s' cannot refer to a row value -''' - -["ddl:4135"] -error = ''' -Sequence '%-.64s.%-.64s' has run out -''' - -["ddl:4136"] -error = ''' -Sequence '%-.64s.%-.64s' values are conflicting -''' - -["ddl:4137"] -error = ''' -Sequence '%-.64s.%-.64s' access error -''' - -["ddl:4138"] -error = ''' -'%-.64s.%-.64s' is not a SEQUENCE -''' - -["ddl:4139"] -error = ''' -Unknown SEQUENCE: '%-.300s' -''' - -["ddl:8200"] -error = ''' -Unsupported partition by range columns -''' - -["ddl:8210"] -error = ''' -Invalid %!s(MISSING) state: %!v(MISSING) -''' - -["ddl:8215"] -error = ''' -Failed to repair table: %s -''' - -["ddl:8216"] -error = ''' -Invalid auto random: %s -''' - -["ddl:8227"] -error = ''' -Unsupported sequence table-option %s -''' - -["ddl:8228"] -error = ''' -Unsupported sequence default value for column type '%s' -''' - -["ddl:8230"] -error = ''' -Unsupported using sequence as default value in add column '%s' -''' - -["ddl:8231"] -error = ''' -%s is not supported -''' - -["ddl:8232"] -error = ''' -CREATE/ALTER table with union option is not supported -''' - -["ddl:8233"] -error = ''' -CREATE/ALTER table with insert method option is not supported -''' - -["ddl:8234"] -error = ''' -Invalid placement policy '%s': %s -''' - -["domain:8027"] -error = ''' -Information schema is out of date: schema failed to update in 1 lease, please make sure TiDB can connect to TiKV -''' - -["domain:8028"] -error = ''' -Information schema is changed during the execution of the statement(for example, table definition may be updated by other DDL ran in parallel). If you see this error often, try increasing `tidb_max_delta_schema_count`. [try again later] -''' - -["domain:9009"] -error = ''' -Prometheus address is not set in PD and etcd -''' - -["executor:1044"] -error = ''' -Access denied for user '%-.48s'@'%-.64s' to database '%-.192s' -''' - -["executor:1049"] -error = ''' -Unknown database '%-.192s' -''' - -["executor:1133"] -error = ''' -Can't find any matching row in the user table -''' - -["executor:1142"] -error = ''' -%-.128s command denied to user '%-.48s'@'%-.64s' for table '%-.64s' -''' - -["executor:1213"] -error = ''' -Deadlock found when trying to get lock; try restarting transaction -''' - -["executor:1317"] -error = ''' -Query execution was interrupted -''' - -["executor:1347"] -error = ''' -'%-.192s.%-.192s' is not %s -''' - -["executor:1390"] -error = ''' -Prepared statement contains too many placeholders -''' - -["executor:1396"] -error = ''' -Operation %s failed for %.256s -''' - -["executor:1410"] -error = ''' -You are not allowed to create a user with GRANT -''' - -["executor:1568"] -error = ''' -Transaction characteristics can't be changed while a transaction is in progress -''' - -["executor:1827"] -error = ''' -The password hash doesn't have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function. -''' - -["executor:8003"] -error = ''' -TiDB admin check table failed. -''' - -["executor:8114"] -error = ''' -Unknown plan -''' - -["executor:8115"] -error = ''' -Can not prepare multiple statements -''' - -["executor:8116"] -error = ''' -Can not prepare DDL statements with parameters -''' - -["executor:8117"] -error = ''' -Result is empty -''' - -["executor:8118"] -error = ''' -Failed to build executor -''' - -["executor:8119"] -error = ''' -Batch insert failed, please clean the table and try again. -''' - -["executor:8120"] -error = ''' -Can not get start ts -''' - -["executor:8124"] -error = ''' -Backup failed: %s -''' - -["executor:8125"] -error = ''' -Restore failed: %s -''' - -["executor:8126"] -error = ''' -Import failed: %s -''' - -["executor:8127"] -error = ''' -Export failed: %s -''' - -["expression:1139"] -error = ''' -Got error '%-.64s' from regexp -''' - -["expression:1235"] -error = ''' -function %s has only noop implementation in tidb now, use tidb_enable_noop_functions to enable these functions -''' - -["expression:1241"] -error = ''' -Operand should contain %d column(s) -''' - -["expression:1260"] -error = ''' -Some rows were cut by GROUPCONCAT(%s) -''' - -["expression:1267"] -error = ''' -Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s' -''' - -["expression:1270"] -error = ''' -Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s' -''' - -["expression:1271"] -error = ''' -Illegal mix of collations for operation '%s' -''' - -["expression:1365"] -error = ''' -Division by 0 -''' - -["expression:1582"] -error = ''' -Incorrect parameter count in the call to native function '%-.192s' -''' - -["expression:3020"] -error = ''' -Invalid argument for logarithm -''' - -["expression:3064"] -error = ''' -Incorrect type for argument %s in function %s. -''' - -["json:3069"] -error = ''' -Invalid JSON data provided to function %s: %s -''' - -["json:3140"] -error = ''' -Invalid JSON text: %-.192s -''' - -["json:3143"] -error = ''' -Invalid JSON path expression %s. -''' - -["json:3149"] -error = ''' -In this situation, path expressions may not contain the * and ** tokens. -''' - -["json:3150"] -error = ''' -The second argument can only be either 'one' or 'all'. -''' - -["json:3158"] -error = ''' -JSON documents may not contain NULL member names. -''' - -["json:3165"] -error = ''' -A path expression is not a path to a cell in an array. -''' - -["json:8066"] -error = ''' -JSON_OBJECTAGG: unsupported second argument type %v -''' - -["kv:1062"] -error = ''' -Duplicate entry '%-.64s' for key '%-.192s' -''' - -["kv:8004"] -error = ''' -Transaction is too large, size: %d -''' - -["kv:8005"] -error = ''' -Write conflict, txnStartTS %d is stale [try again later] -''' - -["kv:8021"] -error = ''' -Error: key not exist -''' - -["kv:8022"] -error = ''' -Error: KV error safe to retry %s [try again later] -''' - -["kv:8023"] -error = ''' -can not set nil value -''' - -["kv:8024"] -error = ''' -invalid transaction -''' - -["kv:8025"] -error = ''' -entry too large, the max entry size is %d, the size of data is %d -''' - -["kv:8026"] -error = ''' -not implemented -''' - -["kv:9007"] -error = ''' -Write conflict, txnStartTS=%d, conflictStartTS=%d, conflictCommitTS=%d, key=%s [try again later] -''' - -["meta:1007"] -error = ''' -Can't create database '%-.192s'; database exists -''' - -["meta:1049"] -error = ''' -Unknown database '%-.192s' -''' - -["meta:1050"] -error = ''' -Table '%-.192s' already exists -''' - -["meta:1146"] -error = ''' -Table '%-.192s.%-.192s' doesn't exist -''' - -["meta:8235"] -error = ''' -DDL reorg element does not exist -''' - -["planner:1044"] -error = ''' -Access denied for user '%-.48s'@'%-.64s' to database '%-.192s' -''' - -["planner:1045"] -error = ''' -Access denied for user '%-.48s'@'%-.64s' -''' - -["planner:1046"] -error = ''' -No database selected -''' - -["planner:1051"] -error = ''' -Unknown table '%-.100s' -''' - -["planner:1052"] -error = ''' -Column '%-.192s' in %-.192s is ambiguous -''' - -["planner:1054"] -error = ''' -Unknown column '%-.192s' in '%-.192s' -''' - -["planner:1055"] -error = ''' -Expression #%d of %s is not in GROUP BY clause and contains nonaggregated column '%s' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by -''' - -["planner:1056"] -error = ''' -Can't group on '%-.192s' -''' - -["planner:1060"] -error = ''' -Duplicate column name '%-.192s' -''' - -["planner:1066"] -error = ''' -Not unique table/alias: '%-.192s' -''' - -["planner:1094"] -error = ''' -Unknown thread id: %d -''' - -["planner:1105"] -error = ''' -Unknown error -''' - -["planner:1109"] -error = ''' -Unknown table '%-.192s' in %-.32s -''' - -["planner:1111"] -error = ''' -Invalid use of group function -''' - -["planner:1136"] -error = ''' -Column count doesn't match value count at row %d -''' - -["planner:1142"] -error = ''' -%-.128s command denied to user '%-.48s'@'%-.64s' for table '%-.64s' -''' - -["planner:1146"] -error = ''' -Table '%-.192s.%-.192s' doesn't exist -''' - -["planner:1176"] -error = ''' -Key '%-.192s' doesn't exist in table '%-.192s' -''' - -["planner:1210"] -error = ''' -Incorrect arguments to %s -''' - -["planner:1221"] -error = ''' -Incorrect usage of %s and %s -''' - -["planner:1222"] -error = ''' -The used SELECT statements have a different number of columns -''' - -["planner:1227"] -error = ''' -Access denied; you need (at least one of) the %-.128s privilege(s) for this operation -''' - -["planner:1235"] -error = ''' -This version of TiDB doesn't yet support '%s' -''' - -["planner:1241"] -error = ''' -Operand should contain %d column(s) -''' - -["planner:1247"] -error = ''' -Reference '%-.64s' not supported (%s) -''' - -["planner:1250"] -error = ''' -Table '%s' from one of the %ss cannot be used in %s -''' - -["planner:1288"] -error = ''' -The target table %-.100s of the %s is not updatable -''' - -["planner:1345"] -error = ''' -EXPLAIN/SHOW can not be issued; lacking privileges for underlying table -''' - -["planner:1356"] -error = ''' -View '%-.192s.%-.192s' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them -''' - -["planner:1462"] -error = ''' -`%-.192s`.`%-.192s` contains view recursion -''' - -["planner:1747"] -error = ''' -PARTITION () clause on non partitioned table -''' - -["planner:1791"] -error = ''' -Unknown EXPLAIN format name: '%s' -''' - -["planner:1815"] -error = ''' -Internal : %s -''' - -["planner:3105"] -error = ''' -The value specified for generated column '%s' in table '%s' is not allowed. -''' - -["planner:3106"] -error = ''' -'%s' is not supported for generated columns. -''' - -["planner:3126"] -error = ''' -Hint %s is ignored as conflicting/duplicated. -''' - -["planner:3128"] -error = ''' -Unresolved name '%s' for %s hint -''' - -["planner:3579"] -error = ''' -Window name '%s' is not defined. -''' - -["planner:3580"] -error = ''' -There is a circularity in the window dependency graph. -''' - -["planner:3581"] -error = ''' -A window which depends on another cannot define partitioning. -''' - -["planner:3582"] -error = ''' -Window '%s' has a frame definition, so cannot be referenced by another window. -''' - -["planner:3583"] -error = ''' -Window '%s' cannot inherit '%s' since both contain an ORDER BY clause. -''' - -["planner:3584"] -error = ''' -Window '%s': frame start cannot be UNBOUNDED FOLLOWING. -''' - -["planner:3585"] -error = ''' -Window '%s': frame end cannot be UNBOUNDED PRECEDING. -''' - -["planner:3586"] -error = ''' -Window '%s': frame start or end is negative, NULL or of non-integral type -''' - -["planner:3587"] -error = ''' -Window '%s' with RANGE N PRECEDING/FOLLOWING frame requires exactly one ORDER BY expression, of numeric or temporal type -''' - -["planner:3588"] -error = ''' -Window '%s' with RANGE frame has ORDER BY expression of datetime type. Only INTERVAL bound value allowed. -''' - -["planner:3589"] -error = ''' -Window '%s' with RANGE frame has ORDER BY expression of numeric type, INTERVAL bound value not allowed. -''' - -["planner:3590"] -error = ''' -Window '%s' has a non-constant frame bound. -''' - -["planner:3591"] -error = ''' -Window '%s' is defined twice. -''' - -["planner:3593"] -error = ''' -You cannot use the window function '%s' in this context.' -''' - -["planner:3594"] -error = ''' -You cannot use the alias '%s' of an expression containing a window function in this context.' -''' - -["planner:3596"] -error = ''' -Window '%s': INTERVAL can only be used with RANGE frames. -''' - -["planner:3599"] -error = ''' -Window function '%s' ignores the frame clause of window '%s' and aggregates over the whole partition -''' - -["planner:3637"] -error = ''' -Variable '%s' cannot be set using SET_VAR hint. -''' - -["planner:8108"] -error = ''' -Unsupported type %T -''' - -["planner:8109"] -error = ''' -Index '%s' in field list does not exist in table '%s' -''' - -["planner:8110"] -error = ''' -Cartesian product is unsupported -''' - -["planner:8111"] -error = ''' -Prepared statement not found -''' - -["planner:8112"] -error = ''' -Wrong parameter count -''' - -["planner:8113"] -error = ''' -Schema has changed -''' - -["planner:8121"] -error = ''' -privilege check fail -''' - -["planner:8122"] -error = ''' -Wildcard fields without any table name appears in wrong place -''' - -["planner:8123"] -error = ''' -In aggregated query without GROUP BY, expression #%d of SELECT list contains nonaggregated column '%s'; this is incompatible with sql_mode=only_full_group_by -''' - -["privilege:1141"] -error = ''' -There is no such grant defined for user '%-.48s' on host '%-.64s' -''' - -["privilege:3530"] -error = ''' -%s is is not granted to %s -''' - -["schema:1007"] -error = ''' -Can't create database '%-.192s'; database exists -''' - -["schema:1008"] -error = ''' -Can't drop database '%-.192s'; database doesn't exist -''' - -["schema:1045"] -error = ''' -Access denied for user '%-.48s'@'%-.64s' (using password: %s) -''' - -["schema:1049"] -error = ''' -Unknown database '%-.192s' -''' - -["schema:1050"] -error = ''' -Table '%-.192s' already exists -''' - -["schema:1051"] -error = ''' -Unknown table '%-.100s' -''' - -["schema:1054"] -error = ''' -Unknown column '%-.192s' in '%-.192s' -''' - -["schema:1060"] -error = ''' -Duplicate column name '%-.192s' -''' - -["schema:1061"] -error = ''' -Duplicate key name '%-.192s' -''' - -["schema:1066"] -error = ''' -Not unique table/alias: '%-.192s' -''' - -["schema:1068"] -error = ''' -Multiple primary key defined -''' - -["schema:1070"] -error = ''' -Too many key parts specified; max %d parts allowed -''' - -["schema:1091"] -error = ''' -Can't DROP '%-.192s'; check that column/key exists -''' - -["schema:1099"] -error = ''' -Table '%-.192s' was locked with a READ lock and can't be updated -''' - -["schema:1100"] -error = ''' -Table '%-.192s' was not locked with LOCK TABLES -''' - -["schema:1146"] -error = ''' -Table '%-.192s.%-.192s' doesn't exist -''' - -["schema:1176"] -error = ''' -Key '%-.192s' doesn't exist in table '%-.192s' -''' - -["schema:1215"] -error = ''' -Cannot add foreign key constraint -''' - -["schema:1239"] -error = ''' -Incorrect foreign key definition for '%-.192s': %s -''' - -["schema:1347"] -error = ''' -'%-.192s.%-.192s' is not %s -''' - -["schema:1831"] -error = ''' -Duplicate index '%-.64s' defined on the table '%-.64s.%-.64s'. This is deprecated and will be disallowed in a future release. -''' - -["schema:3162"] -error = ''' -User %s does not exist. -''' - -["schema:3163"] -error = ''' -User %s already exists. -''' - -["schema:4139"] -error = ''' -Unknown SEQUENCE: '%-.300s' -''' - -["schema:8020"] -error = ''' -Table '%s' was locked in %s by %v -''' - -["session:8002"] -error = ''' -[%d] can not retry select for update statement -''' - -["structure:8217"] -error = ''' -invalid encoded hash key flag -''' - -["structure:8218"] -error = ''' -invalid list index -''' - -["structure:8219"] -error = ''' -invalid list meta data -''' - -["structure:8220"] -error = ''' -write on snapshot -''' - -["table:1048"] -error = ''' -Column '%-.192s' cannot be null -''' - -["table:1054"] -error = ''' -Unknown column '%-.192s' in '%-.192s' -''' - -["table:1192"] -error = ''' -Can't execute the given command because you have active locked tables or an active transaction -''' - -["table:1364"] -error = ''' -Field '%-.192s' doesn't have a default value -''' - -["table:1366"] -error = ''' -Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %d -''' - -["table:1526"] -error = ''' -Table has no partition for value %-.64s -''' - -["table:1735"] -error = ''' -Unknown partition '%-.64s' in table '%-.64s' -''' - -["table:1748"] -error = ''' -Found a row not matching the given partition set -''' - -["table:4135"] -error = ''' -Sequence '%-.64s.%-.64s' has run out -''' - -["table:8039"] -error = ''' -Index column %s offset out of bound, offset: %d, row: %v -''' - -["table:8040"] -error = ''' -operation not supported -''' - -["table:8041"] -error = ''' -can not find the row: %s -''' - -["table:8042"] -error = ''' -table %s can't be in none state -''' - -["table:8043"] -error = ''' -can not use non-public column -''' - -["table:8044"] -error = ''' -index %s can't be in none state -''' - -["table:8045"] -error = ''' -invalid record key -''' - -["table:8046"] -error = ''' -column %s can't be in none state -''' - -["tikv:1105"] -error = ''' -Unknown error -''' - -["tikv:1205"] -error = ''' -Lock wait timeout exceeded; try restarting transaction -''' - -["tikv:1317"] -error = ''' -Query execution was interrupted -''' - -["tikv:3572"] -error = ''' -Statement aborted because lock(s) could not be acquired immediately and NOWAIT is set. -''' - -["tikv:8229"] -error = ''' -TTL manager has timed out, pessimistic locks may expire, please commit or rollback this transaction -''' - -["tikv:9001"] -error = ''' -PD server timeout -''' - -["tikv:9002"] -error = ''' -TiKV server timeout -''' - -["tikv:9003"] -error = ''' -TiKV server is busy -''' - -["tikv:9004"] -error = ''' -Resolve lock timeout -''' - -["tikv:9005"] -error = ''' -Region is unavailable -''' - -["tikv:9006"] -error = ''' -GC life time is shorter than transaction duration, transaction starts at %v, GC safe point is %v -''' - -["tikv:9008"] -error = ''' -Store token is up to the limit, store id = %d -''' - -["tikv:9010"] -error = ''' -TiKV server reports stale command -''' - -["tikv:9011"] -error = ''' -TiKV max timestamp is not synced -''' - -["types:1074"] -error = ''' -Column length too big for column '%-.192s' (max = %d); use BLOB or TEXT instead -''' - -["types:1097"] -error = ''' -Too many strings for column %-.192s and SET -''' - -["types:1264"] -error = ''' -Out of range value for column '%s' at row %d -''' - -["types:1265"] -error = ''' -Data truncated for column '%s' at row %d -''' - -["types:1291"] -error = ''' -Column '%-.100s' has duplicated value '%-.64s' in %s -''' - -["types:1292"] -error = ''' -Truncated incorrect %-.64s value: '%-.128s' -''' - -["types:1365"] -error = ''' -Division by 0 -''' - -["types:1367"] -error = ''' -Illegal %s '%-.192s' value found during parsing -''' - -["types:1406"] -error = ''' -Data too long for column '%s' at row %d -''' - -["types:1411"] -error = ''' -Incorrect %-.32s value: '%-.128s' for function %-.32s -''' - -["types:1425"] -error = ''' -Too big scale %d specified for column '%-.192s'. Maximum is %d. -''' - -["types:1426"] -error = ''' -Too big precision %d specified for column '%-.192s'. Maximum is %d. -''' - -["types:1427"] -error = ''' -For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.192s'). -''' - -["types:1439"] -error = ''' -Display width out of range for column '%-.192s' (max = %d) -''' - -["types:1441"] -error = ''' -Datetime function: %-.32s field overflow -''' - -["types:1690"] -error = ''' -%s value is out of range in '%s' -''' - -["types:3013"] -error = ''' -Invalid size for column '%s'. -''' - -["types:8029"] -error = ''' -Bad Number -''' - -["types:8030"] -error = ''' -Cast to signed converted positive out-of-range integer to it's negative complement -''' - -["types:8031"] -error = ''' -Cast to unsigned converted negative integer to it's positive complement -''' - -["types:8032"] -error = ''' -invalid year format -''' - -["types:8033"] -error = ''' -invalid year -''' - -["types:8037"] -error = ''' -invalid week mode format: '%v' -''' - -["variable:1193"] -error = ''' -Unknown system variable '%-.64s' -''' - -["variable:1231"] -error = ''' -Variable '%-.64s' can't be set to the value of '%-.200s' -''' - -["variable:1232"] -error = ''' -Incorrect argument type to variable '%-.64s' -''' - -["variable:1238"] -error = ''' -Variable '%-.192s' is a %s variable -''' - -["variable:1292"] -error = ''' -Truncated incorrect %-.64s value: '%-.128s' -''' - -["variable:1298"] -error = ''' -Unknown or incorrect time zone: '%-.64s' -''' - -["variable:1461"] -error = ''' -Can't create more than maxPreparedStmtCount statements (current value: %d) -''' - -["variable:1621"] -error = ''' -%s variable '%s' is read-only. Use SET %s to assign the value -''' - -["variable:8047"] -error = ''' -variable '%s' does not yet support value: %s -''' - -["variable:8048"] -error = ''' -The isolation level '%s' is not supported. Set tidb_skip_isolation_level_check=1 to skip this error -''' - -["variable:8055"] -error = ''' -snapshot is older than GC safe point %s -''' - diff --git a/executor/ddl_test.go b/executor/ddl_test.go index 9aa769098a6e9..9d1a9cbedc976 100644 --- a/executor/ddl_test.go +++ b/executor/ddl_test.go @@ -287,10 +287,7 @@ func (s *testSuite3) TestCreateView(c *C) { c.Assert(err.Error(), Equals, "update view v_issue_16253 is not supported now.") } -<<<<<<< HEAD -func (s *testSuite3) TestIssue16250(c *C) { -======= -func (s *testSuite6) TestViewRecursion(c *C) { +func (s *testSuite3) TestViewRecursion(c *C) { tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("create table if not exists t(a int)") @@ -303,8 +300,7 @@ func (s *testSuite6) TestViewRecursion(c *C) { tk.MustExec("drop view recursive_view1, t") } -func (s *testSuite6) TestIssue16250(c *C) { ->>>>>>> f81a5d131... planner: check view recursion when building source from view (#20398) +func (s *testSuite3) TestIssue16250(c *C) { tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("create table if not exists t(a int)") diff --git a/planner/core/errors.go b/planner/core/errors.go index 6ab6ef4b9df08..203f294c020cd 100644 --- a/planner/core/errors.go +++ b/planner/core/errors.go @@ -81,7 +81,6 @@ const ( // error definitions. var ( -<<<<<<< HEAD ErrUnsupportedType = terror.ClassOptimizer.New(codeUnsupportedType, "Unsupported type %T") ErrAnalyzeMissIndex = terror.ClassOptimizer.New(codeAnalyzeMissIndex, "Index '%s' in field list does not exist in table '%s'") ErrCartesianProductUnsupported = terror.ClassOptimizer.New(codeUnsupported, "Cartesian product is unsupported") @@ -127,6 +126,7 @@ var ( ErrWindowDuplicateName = terror.ClassOptimizer.New(codeWindowDuplicateName, mysql.MySQLErrName[mysql.ErrWindowDuplicateName]) ErrPartitionClauseOnNonpartitioned = terror.ClassOptimizer.New(codePartitionClauseOnNonpartitioned, mysql.MySQLErrName[mysql.ErrPartitionClauseOnNonpartitioned]) ErrNoSuchTable = terror.ClassOptimizer.New(mysql.ErrNoSuchTable, mysql.MySQLErrName[mysql.ErrNoSuchTable]) + ErrViewRecursive = terror.ClassOptimizer.New(mysql.ErrViewRecursive, mysql.MySQLErrName[mysql.ErrViewRecursive]) errTooBigPrecision = terror.ClassExpression.New(mysql.ErrTooBigPrecision, mysql.MySQLErrName[mysql.ErrTooBigPrecision]) ErrDBaccessDenied = terror.ClassOptimizer.New(mysql.ErrDBaccessDenied, mysql.MySQLErrName[mysql.ErrDBaccessDenied]) ErrTableaccessDenied = terror.ClassOptimizer.New(mysql.ErrTableaccessDenied, mysql.MySQLErrName[mysql.ErrTableaccessDenied]) @@ -145,74 +145,6 @@ var ( ErrNoSuchThread = terror.ClassOptimizer.New(mysql.ErrNoSuchThread, mysql.MySQLErrName[mysql.ErrNoSuchThread]) // Since we cannot know if user loggined with a password, use message of ErrAccessDeniedNoPassword instead ErrAccessDenied = terror.ClassOptimizer.New(mysql.ErrAccessDenied, mysql.MySQLErrName[mysql.ErrAccessDeniedNoPassword]) -======= - ErrUnsupportedType = dbterror.ClassOptimizer.NewStd(mysql.ErrUnsupportedType) - ErrAnalyzeMissIndex = dbterror.ClassOptimizer.NewStd(mysql.ErrAnalyzeMissIndex) - ErrWrongParamCount = dbterror.ClassOptimizer.NewStd(mysql.ErrWrongParamCount) - ErrSchemaChanged = dbterror.ClassOptimizer.NewStd(mysql.ErrSchemaChanged) - ErrTablenameNotAllowedHere = dbterror.ClassOptimizer.NewStd(mysql.ErrTablenameNotAllowedHere) - ErrNotSupportedYet = dbterror.ClassOptimizer.NewStd(mysql.ErrNotSupportedYet) - ErrWrongUsage = dbterror.ClassOptimizer.NewStd(mysql.ErrWrongUsage) - ErrUnknown = dbterror.ClassOptimizer.NewStd(mysql.ErrUnknown) - ErrUnknownTable = dbterror.ClassOptimizer.NewStd(mysql.ErrUnknownTable) - ErrNoSuchTable = dbterror.ClassOptimizer.NewStd(mysql.ErrNoSuchTable) - ErrViewRecursive = dbterror.ClassOptimizer.NewStd(mysql.ErrViewRecursive) - ErrWrongArguments = dbterror.ClassOptimizer.NewStd(mysql.ErrWrongArguments) - ErrWrongNumberOfColumnsInSelect = dbterror.ClassOptimizer.NewStd(mysql.ErrWrongNumberOfColumnsInSelect) - ErrBadGeneratedColumn = dbterror.ClassOptimizer.NewStd(mysql.ErrBadGeneratedColumn) - ErrFieldNotInGroupBy = dbterror.ClassOptimizer.NewStd(mysql.ErrFieldNotInGroupBy) - ErrBadTable = dbterror.ClassOptimizer.NewStd(mysql.ErrBadTable) - ErrKeyDoesNotExist = dbterror.ClassOptimizer.NewStd(mysql.ErrKeyDoesNotExist) - ErrOperandColumns = dbterror.ClassOptimizer.NewStd(mysql.ErrOperandColumns) - ErrInvalidGroupFuncUse = dbterror.ClassOptimizer.NewStd(mysql.ErrInvalidGroupFuncUse) - ErrIllegalReference = dbterror.ClassOptimizer.NewStd(mysql.ErrIllegalReference) - ErrNoDB = dbterror.ClassOptimizer.NewStd(mysql.ErrNoDB) - ErrUnknownExplainFormat = dbterror.ClassOptimizer.NewStd(mysql.ErrUnknownExplainFormat) - ErrWrongGroupField = dbterror.ClassOptimizer.NewStd(mysql.ErrWrongGroupField) - ErrDupFieldName = dbterror.ClassOptimizer.NewStd(mysql.ErrDupFieldName) - ErrNonUpdatableTable = dbterror.ClassOptimizer.NewStd(mysql.ErrNonUpdatableTable) - ErrInternal = dbterror.ClassOptimizer.NewStd(mysql.ErrInternal) - ErrNonUniqTable = dbterror.ClassOptimizer.NewStd(mysql.ErrNonuniqTable) - ErrWindowInvalidWindowFuncUse = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowInvalidWindowFuncUse) - ErrWindowInvalidWindowFuncAliasUse = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowInvalidWindowFuncAliasUse) - ErrWindowNoSuchWindow = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowNoSuchWindow) - ErrWindowCircularityInWindowGraph = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowCircularityInWindowGraph) - ErrWindowNoChildPartitioning = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowNoChildPartitioning) - ErrWindowNoInherentFrame = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowNoInherentFrame) - ErrWindowNoRedefineOrderBy = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowNoRedefineOrderBy) - ErrWindowDuplicateName = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowDuplicateName) - ErrPartitionClauseOnNonpartitioned = dbterror.ClassOptimizer.NewStd(mysql.ErrPartitionClauseOnNonpartitioned) - ErrWindowFrameStartIllegal = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowFrameStartIllegal) - ErrWindowFrameEndIllegal = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowFrameEndIllegal) - ErrWindowFrameIllegal = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowFrameIllegal) - ErrWindowRangeFrameOrderType = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowRangeFrameOrderType) - ErrWindowRangeFrameTemporalType = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowRangeFrameTemporalType) - ErrWindowRangeFrameNumericType = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowRangeFrameNumericType) - ErrWindowRangeBoundNotConstant = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowRangeBoundNotConstant) - ErrWindowRowsIntervalUse = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowRowsIntervalUse) - ErrWindowFunctionIgnoresFrame = dbterror.ClassOptimizer.NewStd(mysql.ErrWindowFunctionIgnoresFrame) - ErrUnsupportedOnGeneratedColumn = dbterror.ClassOptimizer.NewStd(mysql.ErrUnsupportedOnGeneratedColumn) - ErrPrivilegeCheckFail = dbterror.ClassOptimizer.NewStd(mysql.ErrPrivilegeCheckFail) - ErrInvalidWildCard = dbterror.ClassOptimizer.NewStd(mysql.ErrInvalidWildCard) - ErrMixOfGroupFuncAndFields = dbterror.ClassOptimizer.NewStd(mysql.ErrMixOfGroupFuncAndFieldsIncompatible) - errTooBigPrecision = dbterror.ClassExpression.NewStd(mysql.ErrTooBigPrecision) - ErrDBaccessDenied = dbterror.ClassOptimizer.NewStd(mysql.ErrDBaccessDenied) - ErrTableaccessDenied = dbterror.ClassOptimizer.NewStd(mysql.ErrTableaccessDenied) - ErrSpecificAccessDenied = dbterror.ClassOptimizer.NewStd(mysql.ErrSpecificAccessDenied) - ErrViewNoExplain = dbterror.ClassOptimizer.NewStd(mysql.ErrViewNoExplain) - ErrWrongValueCountOnRow = dbterror.ClassOptimizer.NewStd(mysql.ErrWrongValueCountOnRow) - ErrViewInvalid = dbterror.ClassOptimizer.NewStd(mysql.ErrViewInvalid) - ErrNoSuchThread = dbterror.ClassOptimizer.NewStd(mysql.ErrNoSuchThread) - ErrUnknownColumn = dbterror.ClassOptimizer.NewStd(mysql.ErrBadField) - ErrCartesianProductUnsupported = dbterror.ClassOptimizer.NewStd(mysql.ErrCartesianProductUnsupported) - ErrStmtNotFound = dbterror.ClassOptimizer.NewStd(mysql.ErrPreparedStmtNotFound) - ErrAmbiguous = dbterror.ClassOptimizer.NewStd(mysql.ErrNonUniq) - ErrUnresolvedHintName = dbterror.ClassOptimizer.NewStd(mysql.ErrUnresolvedHintName) - ErrNotHintUpdatable = dbterror.ClassOptimizer.NewStd(mysql.ErrNotHintUpdatable) - ErrWarnConflictingHint = dbterror.ClassOptimizer.NewStd(mysql.ErrWarnConflictingHint) - // Since we cannot know if user logged in with a password, use message of ErrAccessDeniedNoPassword instead - ErrAccessDenied = dbterror.ClassOptimizer.NewStdErr(mysql.ErrAccessDenied, mysql.MySQLErrName[mysql.ErrAccessDeniedNoPassword]) ->>>>>>> f81a5d131... planner: check view recursion when building source from view (#20398) ) func init() { diff --git a/planner/core/planbuilder.go b/planner/core/planbuilder.go index 434bba5cbe22e..69cf61d43782b 100644 --- a/planner/core/planbuilder.go +++ b/planner/core/planbuilder.go @@ -207,62 +207,11 @@ type PlanBuilder struct { // SelectLock need this information to locate the lock on partitions. partitionedTable []table.PartitionedTable -<<<<<<< HEAD - // CreateView needs this information to check whether exists nested view. - underlyingViewNames set.StringSet -======= + // buildingViewStack is used to check whether there is a recursive view. buildingViewStack set.StringSet // renamingViewName is the name of the view which is being renamed. renamingViewName string - - // evalDefaultExpr needs this information to find the corresponding column. - // It stores the OutputNames before buildProjection. - allNames [][]*types.FieldName -} - -type handleColHelper struct { - id2HandleMapStack []map[int64][]HandleCols - stackTail int -} - -func (hch *handleColHelper) appendColToLastMap(tblID int64, handleCols HandleCols) { - tailMap := hch.id2HandleMapStack[hch.stackTail-1] - tailMap[tblID] = append(tailMap[tblID], handleCols) -} - -func (hch *handleColHelper) popMap() map[int64][]HandleCols { - ret := hch.id2HandleMapStack[hch.stackTail-1] - hch.stackTail-- - hch.id2HandleMapStack = hch.id2HandleMapStack[:hch.stackTail] - return ret -} - -func (hch *handleColHelper) pushMap(m map[int64][]HandleCols) { - hch.id2HandleMapStack = append(hch.id2HandleMapStack, m) - hch.stackTail++ -} - -func (hch *handleColHelper) mergeAndPush(m1, m2 map[int64][]HandleCols) { - newMap := make(map[int64][]HandleCols, mathutil.Max(len(m1), len(m2))) - for k, v := range m1 { - newMap[k] = make([]HandleCols, len(v)) - copy(newMap[k], v) - } - for k, v := range m2 { - if _, ok := newMap[k]; ok { - newMap[k] = append(newMap[k], v...) - } else { - newMap[k] = make([]HandleCols, len(v)) - copy(newMap[k], v) - } - } - hch.pushMap(newMap) -} - -func (hch *handleColHelper) tailMap() map[int64][]HandleCols { - return hch.id2HandleMapStack[hch.stackTail-1] ->>>>>>> f81a5d131... planner: check view recursion when building source from view (#20398) } // GetVisitInfo gets the visitInfo of the PlanBuilder.