diff --git a/go/libraries/doltcore/doltdb/system_table.go b/go/libraries/doltcore/doltdb/system_table.go index e3eae4ea1c..7941153532 100644 --- a/go/libraries/doltcore/doltdb/system_table.go +++ b/go/libraries/doltcore/doltdb/system_table.go @@ -167,7 +167,7 @@ func GetPersistedSystemTables(ctx context.Context, root RootValue) ([]string, er // GetGeneratedSystemTables returns table names of all generated system tables. func GetGeneratedSystemTables(ctx context.Context, root RootValue) ([]string, error) { - s := set.NewStrSet(getGeneratedSystemTables()) + s := set.NewStrSet(generatedSystemTables) tn, err := root.GetTableNames(ctx, DefaultSchemaName) if err != nil { @@ -206,19 +206,17 @@ var getWriteableSystemTables = func() []string { } } -var getGeneratedSystemTables = func() []string { - return []string{ - GetBranchesTableName(), - GetRemoteBranchesTableName(), - GetLogTableName(), - GetTableOfTablesInConflictName(), - GetTableOfTablesWithViolationsName(), - GetCommitsTableName(), - GetCommitAncestorsTableName(), - GetStatusTableName(), - GetRemotesTableName(), - GetHelpTableName(), - } +var generatedSystemTables = []string{ + BranchesTableName, + RemoteBranchesTableName, + LogTableName, + TableOfTablesInConflictName, + TableOfTablesWithViolationsName, + CommitsTableName, + CommitAncestorsTableName, + StatusTableName, + RemotesTableName, + HelpTableName, } var generatedSystemTablePrefixes = []string{ @@ -306,46 +304,6 @@ const ( DoltWorkspaceTablePrefix = "dolt_workspace_" ) -// GetBranchesTableName returns the branches system table name -var GetBranchesTableName = func() string { - return BranchesTableName -} - -// GetColumnDiffTableName returns the column diff system table name -var GetColumnDiffTableName = func() string { - return ColumnDiffTableName -} - -// GetCommitAncestorsTableName returns the commit_ancestors system table name -var GetCommitAncestorsTableName = func() string { - return CommitAncestorsTableName -} - -// GetCommitsTableName returns the commits system table name -var GetCommitsTableName = func() string { - return CommitsTableName -} - -// GetTableOfTablesWithViolationsName returns the conflicts system table name -var GetTableOfTablesInConflictName = func() string { - return TableOfTablesInConflictName -} - -// GetTableOfTablesWithViolationsName returns the constraint violations system table name -var GetTableOfTablesWithViolationsName = func() string { - return TableOfTablesWithViolationsName -} - -// GetDiffTableName returns the diff system table name -var GetDiffTableName = func() string { - return DiffTableName -} - -// GetLogTableName returns the log system table name -var GetLogTableName = func() string { - return LogTableName -} - // GetMergeStatusTableName returns the merge status system table name var GetMergeStatusTableName = func() string { return MergeStatusTableName @@ -356,36 +314,16 @@ var GetRebaseTableName = func() string { return RebaseTableName } -// GetRemoteBranchesTableName returns the all-branches system table name -var GetRemoteBranchesTableName = func() string { - return RemoteBranchesTableName -} - -// GetRemotesTableName returns the remotes system table name -var GetRemotesTableName = func() string { - return RemotesTableName -} - // GetSchemaConflictsTableName returns the schema conflicts system table name var GetSchemaConflictsTableName = func() string { return SchemaConflictsTableName } -// GetStatusTableName returns the status system table name. -var GetStatusTableName = func() string { - return StatusTableName -} - // GetTagsTableName returns the tags table name var GetTagsTableName = func() string { return TagsTableName } -// GetHelpTableName returns the help table name -var GetHelpTableName = func() string { - return HelpTableName -} - const ( // LogTableName is the log system table name LogTableName = "dolt_log" diff --git a/go/libraries/doltcore/sqle/database.go b/go/libraries/doltcore/sqle/database.go index f75e5f5299..fd6228de0e 100644 --- a/go/libraries/doltcore/sqle/database.go +++ b/go/libraries/doltcore/sqle/database.go @@ -474,7 +474,7 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds found := false tname := doltdb.TableName{Name: lwrName, Schema: db.schemaName} switch lwrName { - case doltdb.GetLogTableName(), doltdb.LogTableName: + case doltdb.LogTableName: isDoltgresSystemTable, err := resolve.IsDoltgresSystemTable(ctx, tname, root) if err != nil { return nil, false, err @@ -490,7 +490,7 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds dt, found = dtables.NewLogTable(ctx, db.Name(), lwrName, db.ddb, head), true } - case doltdb.DiffTableName, doltdb.GetDiffTableName(): + case doltdb.DiffTableName: isDoltgresSystemTable, err := resolve.IsDoltgresSystemTable(ctx, tname, root) if err != nil { return nil, false, err @@ -506,7 +506,7 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds dt, found = dtables.NewUnscopedDiffTable(ctx, db.Name(), lwrName, db.ddb, head), true } - case doltdb.ColumnDiffTableName, doltdb.GetColumnDiffTableName(): + case doltdb.ColumnDiffTableName: isDoltgresSystemTable, err := resolve.IsDoltgresSystemTable(ctx, tname, root) if err != nil { return nil, false, err @@ -522,7 +522,7 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds dt, found = dtables.NewColumnDiffTable(ctx, db.Name(), lwrName, db.ddb, head), true } - case doltdb.TableOfTablesInConflictName, doltdb.GetTableOfTablesInConflictName(): + case doltdb.TableOfTablesInConflictName: isDoltgresSystemTable, err := resolve.IsDoltgresSystemTable(ctx, tname, root) if err != nil { return nil, false, err @@ -530,7 +530,7 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds if !resolve.UseSearchPath || isDoltgresSystemTable { dt, found = dtables.NewTableOfTablesInConflict(ctx, db.RevisionQualifiedName(), lwrName, db.ddb), true } - case doltdb.TableOfTablesWithViolationsName, doltdb.GetTableOfTablesWithViolationsName(): + case doltdb.TableOfTablesWithViolationsName: isDoltgresSystemTable, err := resolve.IsDoltgresSystemTable(ctx, tname, root) if err != nil { return nil, false, err @@ -546,7 +546,7 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds if !resolve.UseSearchPath || isDoltgresSystemTable { dt, found = dtables.NewSchemaConflictsTable(ctx, db.RevisionQualifiedName(), lwrName, db.ddb), true } - case doltdb.GetBranchesTableName(), doltdb.BranchesTableName: + case doltdb.BranchesTableName: isDoltgresSystemTable, err := resolve.IsDoltgresSystemTable(ctx, tname, root) if err != nil { return nil, false, err @@ -554,7 +554,7 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds if !resolve.UseSearchPath || isDoltgresSystemTable { dt, found = dtables.NewBranchesTable(ctx, db, lwrName), true } - case doltdb.RemoteBranchesTableName, doltdb.GetRemoteBranchesTableName(): + case doltdb.RemoteBranchesTableName: isDoltgresSystemTable, err := resolve.IsDoltgresSystemTable(ctx, tname, root) if err != nil { return nil, false, err @@ -562,7 +562,7 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds if !resolve.UseSearchPath || isDoltgresSystemTable { dt, found = dtables.NewRemoteBranchesTable(ctx, db, lwrName), true } - case doltdb.RemotesTableName, doltdb.GetRemotesTableName(): + case doltdb.RemotesTableName: isDoltgresSystemTable, err := resolve.IsDoltgresSystemTable(ctx, tname, root) if err != nil { return nil, false, err @@ -570,7 +570,7 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds if !resolve.UseSearchPath || isDoltgresSystemTable { dt, found = dtables.NewRemotesTable(ctx, db.ddb, lwrName), true } - case doltdb.CommitsTableName, doltdb.GetCommitsTableName(): + case doltdb.CommitsTableName: isDoltgresSystemTable, err := resolve.IsDoltgresSystemTable(ctx, tname, root) if err != nil { return nil, false, err @@ -578,7 +578,7 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds if !resolve.UseSearchPath || isDoltgresSystemTable { dt, found = dtables.NewCommitsTable(ctx, db.Name(), lwrName, db.ddb), true } - case doltdb.CommitAncestorsTableName, doltdb.GetCommitAncestorsTableName(): + case doltdb.CommitAncestorsTableName: isDoltgresSystemTable, err := resolve.IsDoltgresSystemTable(ctx, tname, root) if err != nil { return nil, false, err @@ -586,7 +586,7 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds if !resolve.UseSearchPath || isDoltgresSystemTable { dt, found = dtables.NewCommitAncestorsTable(ctx, db.Name(), lwrName, db.ddb), true } - case doltdb.GetStatusTableName(), doltdb.StatusTableName: + case doltdb.StatusTableName: isDoltgresSystemTable, err := resolve.IsDoltgresSystemTable(ctx, tname, root) if err != nil { return nil, false, err @@ -714,7 +714,7 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds return nil, false, err } dt = NewSchemaTable(backingTable) - case doltdb.GetHelpTableName(), doltdb.HelpTableName: + case doltdb.HelpTableName: isDoltgresSystemTable, err := resolve.IsDoltgresSystemTable(ctx, tname, root) if err != nil { return nil, false, err