-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement SYNONYM in CREATE TABLE (#172)
* Implement SYNONYM in CREATE TABLE * Update testdata * Fix redundant whitespace in (*Synonym).SQL() * Apply suggestions from code review Co-authored-by: Hiroya Fujinami <[email protected]> --------- Co-authored-by: Hiroya Fujinami <[email protected]>
- Loading branch information
1 parent
2fef70c
commit ff8609d
Showing
30 changed files
with
458 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CREATE TABLE Singers ( | ||
SingerId INT64 NOT NULL, | ||
SingerName STRING(1024), | ||
SYNONYM (Artists) | ||
) PRIMARY KEY (SingerId) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- It is still valid CREATE TABLE statement. | ||
CREATE TABLE Singers ( | ||
SYNONYM (Ignored), | ||
SingerId INT64 NOT NULL, | ||
SingerName STRING(1024), | ||
SYNONYM (Artists) | ||
) PRIMARY KEY (SingerId) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
--- create_table_synonyms.sql | ||
CREATE TABLE Singers ( | ||
SingerId INT64 NOT NULL, | ||
SingerName STRING(1024), | ||
SYNONYM (Artists) | ||
) PRIMARY KEY (SingerId) | ||
--- AST | ||
&ast.CreateTable{ | ||
Create: 0, | ||
Rparen: 126, | ||
IfNotExists: false, | ||
Name: &ast.Ident{ | ||
NamePos: 13, | ||
NameEnd: 20, | ||
Name: "Singers", | ||
}, | ||
Columns: []*ast.ColumnDef{ | ||
&ast.ColumnDef{ | ||
Null: 46, | ||
Name: &ast.Ident{ | ||
NamePos: 27, | ||
NameEnd: 35, | ||
Name: "SingerId", | ||
}, | ||
Type: &ast.ScalarSchemaType{ | ||
NamePos: 36, | ||
Name: "INT64", | ||
}, | ||
NotNull: true, | ||
DefaultExpr: (*ast.ColumnDefaultExpr)(nil), | ||
GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), | ||
Options: (*ast.Options)(nil), | ||
}, | ||
&ast.ColumnDef{ | ||
Null: -1, | ||
Name: &ast.Ident{ | ||
NamePos: 56, | ||
NameEnd: 66, | ||
Name: "SingerName", | ||
}, | ||
Type: &ast.SizedSchemaType{ | ||
NamePos: 67, | ||
Rparen: 78, | ||
Name: "STRING", | ||
Max: false, | ||
Size: &ast.IntLiteral{ | ||
ValuePos: 74, | ||
ValueEnd: 78, | ||
Base: 10, | ||
Value: "1024", | ||
}, | ||
}, | ||
NotNull: false, | ||
DefaultExpr: (*ast.ColumnDefaultExpr)(nil), | ||
GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), | ||
Options: (*ast.Options)(nil), | ||
}, | ||
}, | ||
TableConstraints: []*ast.TableConstraint(nil), | ||
PrimaryKeys: []*ast.IndexKey{ | ||
&ast.IndexKey{ | ||
DirPos: -1, | ||
Name: &ast.Ident{ | ||
NamePos: 118, | ||
NameEnd: 126, | ||
Name: "SingerId", | ||
}, | ||
Dir: "", | ||
}, | ||
}, | ||
Synonyms: []*ast.Synonym{ | ||
&ast.Synonym{ | ||
Synonym: 85, | ||
Rparen: 101, | ||
Name: &ast.Ident{ | ||
NamePos: 94, | ||
NameEnd: 101, | ||
Name: "Artists", | ||
}, | ||
}, | ||
}, | ||
Cluster: (*ast.Cluster)(nil), | ||
RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), | ||
} | ||
|
||
--- SQL | ||
CREATE TABLE Singers (SingerId INT64 NOT NULL, SingerName STRING(1024), SYNONYM (Artists)) PRIMARY KEY (SingerId) |
Oops, something went wrong.