Skip to content

Commit

Permalink
make constraint name optional for primary key (#319)
Browse files Browse the repository at this point in the history
Co-authored-by: James Cor <[email protected]>
  • Loading branch information
jycor and James Cor authored Mar 12, 2024
1 parent 9bc43e5 commit 96a83d3
Show file tree
Hide file tree
Showing 3 changed files with 1,011 additions and 983 deletions.
23 changes: 22 additions & 1 deletion go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6200,7 +6200,8 @@ func TestCreateTable(t *testing.T) {
" time1 timestamp on update current_timestamp(0),\n" +
" time2 timestamp default current_timestamp(0) on update current_timestamp(0)\n" +
")",
}, {
},
{
// test alternate key syntax
input: "create table t (\n" +
" id int,\n" +
Expand All @@ -6218,6 +6219,26 @@ func TestCreateTable(t *testing.T) {
" unique namedx (full_name),\n" +
" primary key (id)\n" +
")",
},
{
input: "create table t (\n" +
" id int,\n" +
" constraint primary key (id)\n" +
")",
output: "create table t (\n" +
" id int,\n" +
" primary key (id)\n" +
")",
},
{
input: "create table t (\n" +
" id int,\n" +
" constraint abc primary key def (id)\n" +
")",
output: "create table t (\n" +
" id int,\n" +
" primary key (id)\n" +
")",
},
{
// test now
Expand Down
Loading

0 comments on commit 96a83d3

Please sign in to comment.