Skip to content

Commit

Permalink
support multiple like tables
Browse files Browse the repository at this point in the history
  • Loading branch information
James Cor committed Nov 8, 2024
1 parent 860772b commit fd871a8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -2679,19 +2679,19 @@ const (

// OptLike works for create table xxx like xxx
type OptLike struct {
LikeTable TableName
LikeTables []TableName
}

// Format formats the node.
func (node *OptLike) Format(buf *TrackedBuffer) {
buf.Myprintf("like %v", node.LikeTable)
buf.Myprintf("like %v", node.LikeTables[0])
}

func (node *OptLike) walkSubtree(visit Visit) error {
if node == nil {
return nil
}
return Walk(visit, node.LikeTable)
return Walk(visit, node.LikeTables[0])
}

type OptSelect struct {
Expand Down
2 changes: 1 addition & 1 deletion go/vt/sqlparser/sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/vt/sqlparser/sql.y
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ create_statement:
}
| create_table_prefix LIKE table_name
{
$1.(*DDL).OptLike = &OptLike{LikeTable: $3.(TableName)}
$1.(*DDL).OptLike = &OptLike{LikeTables: []TableName{$3.(TableName)}}
$$ = $1.(*DDL)
}
| CREATE key_type_opt INDEX sql_id using_opt ON table_name '(' index_column_list ')' index_option_list_opt
Expand Down

0 comments on commit fd871a8

Please sign in to comment.