Skip to content

Commit cbdedd4

Browse files
committed
Moving new analyzer rule into Doltgres package
1 parent 6dba7af commit cbdedd4

File tree

2 files changed

+5
-113
lines changed

2 files changed

+5
-113
lines changed

sql/analyzer/add_implicit_prefix_lengths.go

Lines changed: 0 additions & 111 deletions
This file was deleted.

sql/analyzer/validate_create_table.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ func resolveAlterColumn(ctx *sql.Context, a *Analyzer, n sql.Node, scope *plan.S
258258
return nil, transform.SameTree, err
259259
}
260260

261-
sch, err = validateAddColumn(initialSch, sch, n.(*plan.AddColumn))
261+
sch, err = ValidateAddColumn(sch, n.(*plan.AddColumn))
262262
if err != nil {
263263
return nil, transform.SameTree, err
264264
}
@@ -395,7 +395,10 @@ func validateRenameColumn(initialSch, sch sql.Schema, rc *plan.RenameColumn) (sq
395395
return renameInSchema(sch, rc.ColumnName, rc.NewColumnName, nameable.Name()), nil
396396
}
397397

398-
func validateAddColumn(initialSch sql.Schema, schema sql.Schema, ac *plan.AddColumn) (sql.Schema, error) {
398+
// ValidateAddColumn validates that the column specified in |ac| can be added to the specified
399+
// |schema|. A new Schema is returned, with the added column, if the column can be added. Otherwise,
400+
// an error is returned if there are any validation errors.
401+
func ValidateAddColumn(schema sql.Schema, ac *plan.AddColumn) (sql.Schema, error) {
399402
table := ac.Table
400403
nameable := table.(sql.Nameable)
401404

0 commit comments

Comments
 (0)