Skip to content

Commit

Permalink
Fix ALTER DABATASE to support optional schema name
Browse files Browse the repository at this point in the history
  • Loading branch information
JanJakes committed Oct 30, 2024
1 parent dfee145 commit 1c7c18c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,23 @@
]
]
},
{
"name": "schemaRef_zero_or_one",
"bnf": [
[
"schemaRef"
],
[
"\u03b5"
]
]
},
{
"name": "alterDatabase",
"bnf": [
[
"DATABASE_SYMBOL",
"schemaRef",
"schemaRef_zero_or_one",
"%alterDatabase02"
]
]
Expand Down
3 changes: 2 additions & 1 deletion custom-parser/grammar-factoring/MySQLParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ alterInstance:
;

alterDatabase:
DATABASE_SYMBOL schemaRef (
/* @FIX: Make "schemaRef" optional. */
DATABASE_SYMBOL schemaRef? (
createDatabaseOption+
| {serverVersion < 80000}? UPGRADE_SYMBOL DATA_SYMBOL DIRECTORY_SYMBOL NAME_SYMBOL
)
Expand Down
2 changes: 1 addition & 1 deletion custom-parser/parser/grammar.php

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions tests/parser/data/failures.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"SELECT 1 /*!99999 /* */ */"
"select 1ea10.1a20,1e+ 1e+10 from 1ea10"
"ALTER DATABASE DEFAULT CHARACTER SET latin2"
"聠聡聢聣聤聬聭聮聯聰聲聽隆垄拢陇楼卤潞禄录陆戮 聶職聳聴
0聲5
1聲5
Expand All @@ -17,8 +16,4 @@ SET NAMES gb18030"
"SELECT 'a%' LIKE 'a!%' ESCAPE '$', 'a%' LIKE 'a!' || '%' ESCAPE '$'"
"SELECT 'a%' NOT LIKE 'a!%' ESCAPE '$', 'a%' NOT LIKE 'a!' || '%' ESCAPE '$'"
"ALTER SCHEMA s1 READ ONLY DEFAULT"
"create procedure mysqltest1.p1()
begin
alter database character set koi8r;
end"
"load data infile '../../std_data/words.dat' into table t1 (a) set b:= f1()"
2 changes: 1 addition & 1 deletion tests/parser/data/stats.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Total: 69603 | Failures: 14 / 0% | Exceptions: 0 / 0%
Total: 69603 | Failures: 12 / 0% | Exceptions: 0 / 0%

0 comments on commit 1c7c18c

Please sign in to comment.