Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Driver parity #21

Merged
merged 27 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
dd462c9
Port recently added tests to the new driver test suite
JanJakes Feb 12, 2025
bd9b1aa
Include index column subparts (lenghts) in SHOW CREATE TABLE
JanJakes Feb 12, 2025
9d2f8b2
Port query test suite to the new driver
JanJakes Feb 12, 2025
e3b62c8
Implement SHOW COLUMNS statement
JanJakes Feb 12, 2025
dbc4bda
Use reserved driver prefix also for information schema tables
JanJakes Feb 12, 2025
94c865f
Improve correctness of column identifiers as per sql_yacc.yy
JanJakes Feb 14, 2025
a4c55f3
Improve "alterOrderList" grammar fix as per sql_yacc.yy
JanJakes Feb 14, 2025
15634f8
Use "simpleIdentifier" as per sql_yacc.yy
JanJakes Feb 14, 2025
5c405be
Fix comment
JanJakes Feb 14, 2025
06427c1
Add missing version constraints
JanJakes Feb 14, 2025
1fc98ab
Translate information schema table references
JanJakes Feb 12, 2025
81aa42b
Add support for USE <database> statement (supports main DB and inform…
JanJakes Feb 12, 2025
d43ca92
Fix exact values of row format and create options in information schema
JanJakes Feb 17, 2025
0d989b6
Implement TRUNCATE TABLE statement
JanJakes Feb 17, 2025
dbf54c8
Implement ANALYZE TABLE statement
JanJakes Feb 28, 2025
b38106e
Implement CHECK TABLE statement
JanJakes Feb 28, 2025
00db965
Implement OPTIMIZE TABLE and REPAIR TABLE statements
JanJakes Feb 28, 2025
bc6189f
Use correct PDO exception and code when table not found
JanJakes Mar 3, 2025
3502b1f
Port metadata test suite to the new driver
JanJakes Mar 3, 2025
08043bc
Add test for skiping index hints
JanJakes Mar 3, 2025
aa659c7
Unify temp schema quotes, add DROP TEMPORARY TABLE test
JanJakes Mar 3, 2025
4dae813
Add some more TODO comments
JanJakes Mar 3, 2025
0690f44
Check for auto increment edge case, add test
JanJakes Mar 3, 2025
99c0350
Disallow accessing object with reserved prefix
JanJakes Mar 3, 2025
b48f210
Make infromation schema tables readonly
JanJakes Mar 4, 2025
abdd93e
Add comments explaining <prefix> placeholder
JanJakes Mar 5, 2025
c6bc3cb
Improve TODO comment
JanJakes Mar 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 35 additions & 20 deletions grammar-tools/MySQLParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,18 @@ alterListItem:
| OPEN_PAR_SYMBOL tableElementList CLOSE_PAR_SYMBOL
)
| ADD_SYMBOL tableConstraintDef
| CHANGE_SYMBOL COLUMN_SYMBOL? columnInternalRef identifier fieldDefinition place?
| MODIFY_SYMBOL COLUMN_SYMBOL? columnInternalRef fieldDefinition place?
/* @CHANGED: Replaced "columnInternalRef" with "fieldIdentifier" as per sql_yacc.yy. */
| CHANGE_SYMBOL COLUMN_SYMBOL? fieldIdentifier identifier fieldDefinition place?
/* @CHANGED: Replaced "columnInternalRef" with "fieldIdentifier" as per sql_yacc.yy. */
| MODIFY_SYMBOL COLUMN_SYMBOL? fieldIdentifier fieldDefinition place?
| DROP_SYMBOL (
COLUMN_SYMBOL? columnInternalRef restrict?
/* @CHANGED: Replaced "columnInternalRef" with "fieldIdentifier" as per sql_yacc.yy. */
COLUMN_SYMBOL? fieldIdentifier restrict?
| FOREIGN_SYMBOL KEY_SYMBOL (
/* @CHANGED: Replaced "columnInternalRef" with "fieldIdentifier" as per sql_yacc.yy. */
// This part is no longer optional starting with 5.7.
{serverVersion >= 50700}? columnInternalRef
| {serverVersion < 50700}? columnInternalRef?
{serverVersion >= 50700}? fieldIdentifier
| {serverVersion < 50700}? fieldIdentifier?
)
| PRIMARY_SYMBOL KEY_SYMBOL
| keyOrIndex indexRef
Expand All @@ -314,7 +318,8 @@ alterListItem:
)
| DISABLE_SYMBOL KEYS_SYMBOL
| ENABLE_SYMBOL KEYS_SYMBOL
| ALTER_SYMBOL COLUMN_SYMBOL? columnInternalRef (
/* @CHANGED: Replaced "columnInternalRef" with "fieldIdentifier" as per sql_yacc.yy. */
| ALTER_SYMBOL COLUMN_SYMBOL? fieldIdentifier (
SET_SYMBOL DEFAULT_SYMBOL (
{serverVersion >= 80014}? exprWithParentheses
| signedLiteral
Expand All @@ -325,7 +330,8 @@ alterListItem:
| {serverVersion >= 80000}? ALTER_SYMBOL INDEX_SYMBOL indexRef visibility
| {serverVersion >= 80017}? ALTER_SYMBOL CHECK_SYMBOL identifier constraintEnforcement
| {serverVersion >= 80019}? ALTER_SYMBOL CONSTRAINT_SYMBOL identifier constraintEnforcement
| {serverVersion >= 80000}? RENAME_SYMBOL COLUMN_SYMBOL columnInternalRef TO_SYMBOL identifier
/* @CHANGED: Replaced "columnInternalRef" with "fieldIdentifier" as per sql_yacc.yy. */
| {serverVersion >= 80000}? RENAME_SYMBOL COLUMN_SYMBOL fieldIdentifier TO_SYMBOL identifier
| RENAME_SYMBOL (TO_SYMBOL | AS_SYMBOL)? tableName
| {serverVersion >= 50700}? RENAME_SYMBOL keyOrIndex indexRef TO_SYMBOL indexName
| CONVERT_SYMBOL TO_SYMBOL charset (
Expand Down Expand Up @@ -353,11 +359,11 @@ restrict:

/*
* @CHANGED:
* Fixed ALTER TABLE with ORDER to use 'qualifiedIdentifier' instead of just 'identifier'.
* Fixed ALTER TABLE with ORDER to use 'simpleIdentifier' instead of just 'identifier'.
* This is necessary to support "t.id" in a query like "ALTER TABLE t ORDER BY t.id".
*/
alterOrderList:
qualifiedIdentifier direction? (COMMA_SYMBOL qualifiedIdentifier direction?)*
simpleIdentifier direction? (COMMA_SYMBOL simpleIdentifier direction?)*
;

alterAlgorithmOption:
Expand Down Expand Up @@ -1711,7 +1717,7 @@ xid:
/*
* @CHANGED:
* Fixed "replicationStatement" to correctly support the "RESET PERSIST" statement.
* The "ifExists" clause wasn't optional, and "identifier" was used instead of "qualifiedIdentifier".
* The "ifExists" clause wasn't optional, and "identifier" was used instead of "internalVariableName".
*/
replicationStatement:
PURGE_SYMBOL (BINARY_SYMBOL | MASTER_SYMBOL) LOGS_SYMBOL (
Expand Down Expand Up @@ -3561,7 +3567,8 @@ getDiagnostics:
signalAllowedExpr:
literal
| variable
| qualifiedIdentifier
/* @CHANGED: Changed "qualifiedIdentifier" to "simpleIdentifier" as per sql_yacc.yy. */
| simpleIdentifier
;

statementInformationItem:
Expand Down Expand Up @@ -3627,7 +3634,8 @@ schedule:
;

columnDefinition:
columnName fieldDefinition checkOrReferences?
/* @CHANGED: Replaced "columnInternalRef" with "fieldIdentifier" as per sql_yacc.yy. */
fieldIdentifier fieldDefinition checkOrReferences?
;

checkOrReferences:
Expand Down Expand Up @@ -4265,16 +4273,19 @@ usePartition:
// Sometimes we need additional reference rules with different form, depending on the place such a reference is used.

// A name for a field (column/index). Can be qualified with the current schema + table (although it's not a reference).
/* @CHANGED: Moved the conditional from "columnName" to "fieldIdentifier" as per sql_yacc.yy. */
fieldIdentifier:
dotIdentifier
| qualifiedIdentifier dotIdentifier?
// With server 8.0 this became a simple identifier.
{serverVersion < 80000}? (dotIdentifier | qualifiedIdentifier dotIdentifier?)
| {serverVersion >= 80000}? identifier
;

columnName:
/* @CHANGED: Replaced more universally with "fieldIdentifier" as per sql_yacc.yy. */
/*columnName:
// With server 8.0 this became a simple identifier.
{serverVersion >= 80000}? identifier
| {serverVersion < 80000}? fieldIdentifier
;
;*/

// A reference to a column of the object we are working on.
columnInternalRef:
Expand Down Expand Up @@ -4340,12 +4351,14 @@ triggerRef:

viewName:
qualifiedIdentifier
| dotIdentifier
/* @CHANGED: Added missing version constraint. */
| {serverVersion < 80000}? dotIdentifier
;

viewRef:
qualifiedIdentifier
| dotIdentifier
/* @CHANGED: Added missing version constraint. */
| {serverVersion < 80000}? dotIdentifier
;

tablespaceName:
Expand Down Expand Up @@ -4390,7 +4403,8 @@ engineRef:

tableName:
qualifiedIdentifier
| dotIdentifier
/* @CHANGED: Added missing version constraint. */
| {serverVersion < 80000}? dotIdentifier
;

filterTableRef: // Always qualified.
Expand All @@ -4403,7 +4417,8 @@ tableRefWithWildcard:

tableRef:
qualifiedIdentifier
| dotIdentifier
/* @CHANGED: Added missing version constraint. */
| {serverVersion < 80000}? dotIdentifier
;

tableRefList:
Expand Down
Loading