Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion parser/parser_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (p *Parser) parseCreateDatabase(pos Pos) (*CreateDatabase, error) {
return nil, err
}
if engineExpr != nil {
StatementEnd = onCluster.End()
StatementEnd = engineExpr.End()
}
commentExpr, err := p.tryParseComment()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions parser/testdata/ddl/create_database_replicated.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE DATABASE IF NOT EXISTS `test` ENGINE=Replicated('/root/test_local', 'shard', 'replica');
6 changes: 6 additions & 0 deletions parser/testdata/ddl/format/create_database_replicated.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Origin SQL:
CREATE DATABASE IF NOT EXISTS `test` ENGINE=Replicated('/root/test_local', 'shard', 'replica');


-- Format SQL:
CREATE DATABASE IF NOT EXISTS `test` ENGINE = Replicated('/root/test_local', 'shard', 'replica');
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[
{
"CreatePos": 0,
"StatementEnd": 54,
"Name": {
"Name": "test",
"QuoteType": 3,
"NamePos": 31,
"NameEnd": 35
},
"IfNotExists": true,
"OnCluster": null,
"Engine": {
"EnginePos": 37,
"EngineEnd": 54,
"Name": "Replicated",
"Params": {
"LeftParenPos": 54,
"RightParenPos": 93,
"Items": {
"ListPos": 56,
"ListEnd": 92,
"HasDistinct": false,
"Items": [
{
"Expr": {
"LiteralPos": 56,
"LiteralEnd": 72,
"Literal": "/root/test_local"
},
"Alias": null
},
{
"Expr": {
"LiteralPos": 76,
"LiteralEnd": 81,
"Literal": "shard"
},
"Alias": null
},
{
"Expr": {
"LiteralPos": 85,
"LiteralEnd": 92,
"Literal": "replica"
},
"Alias": null
}
]
},
"ColumnArgList": null
},
"PrimaryKey": null,
"PartitionBy": null,
"SampleBy": null,
"TTL": null,
"Settings": null,
"OrderBy": null
},
"Comment": null
}
]