Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
121 changes: 0 additions & 121 deletions server/analyzer/add_implicit_prefix_lengths.go

This file was deleted.

4 changes: 0 additions & 4 deletions server/analyzer/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const (
ruleId_ReplaceIndexedTables // replaceIndexedTables
ruleId_ReplaceNode // replaceNode
ruleId_ReplaceSerial // replaceSerial
ruleId_AddImplicitPrefixLengths // addImplicitPrefixLengths
ruleId_InsertContextRootFinalizer // insertContextRootFinalizer
ruleId_ResolveType // resolveType
ruleId_ReplaceArithmeticExpressions // replaceArithmeticExpressions
Expand All @@ -57,10 +56,7 @@ func Init() {
analyzer.Rule{Id: ruleId_ReplaceIndexedTables, Apply: ReplaceIndexedTables},
)

// PostgreSQL doesn't have the concept of prefix lengths, so we add a rule to implicitly add them
// TODO: this should be replaced by implementing automatic toast semantics for blob types
analyzer.OnceBeforeDefault = append([]analyzer.Rule{
{Id: ruleId_AddImplicitPrefixLengths, Apply: AddImplicitPrefixLengths},
{Id: ruleId_ApplyTablesForAnalyzeAllTables, Apply: applyTablesForAnalyzeAllTables},
{Id: ruleId_ConvertDropPrimaryKeyConstraint, Apply: convertDropPrimaryKeyConstraint}},
analyzer.OnceBeforeDefault...)
Expand Down
10 changes: 10 additions & 0 deletions server/analyzer/validate_create_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ func validateIndexes(ctx *sql.Context, sch sql.Schema, idxDefs sql.IndexDefs) er
return nil
}

// schToColMap returns a map of columns, keyed by their name, for the specified
// schema |sch|.
func schToColMap(sch sql.Schema) map[string]*sql.Column {
colMap := make(map[string]*sql.Column, len(sch))
for _, col := range sch {
colMap[strings.ToLower(col.Name)] = col
}
return colMap
}

// validateIndex ensures that the Index Definition is valid for the table schema.
// This function will throw errors and warnings as needed.
// All columns in the index must be:
Expand Down