Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support multiple like tables #375

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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
jycor marked this conversation as resolved.
Show resolved Hide resolved
}

// 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