MCPcopy Create free account
hub / github.com/dolthub/doltgresql / ResolveTableName

Method ResolveTableName

core/rootvalue.go:837–871  ·  view source on GitHub ↗

ResolveTableName implements the interface doltdb.RootValue.

(ctx context.Context, tName doltdb.TableName)

Source from the content-addressed store, hash-verified

835
836// ResolveTableName implements the interface doltdb.RootValue.
837func (root *RootValue) ResolveTableName(ctx context.Context, tName doltdb.TableName) (string, bool, error) {
838 // Check the tables first
839 tableMap, err := root.getTableMap(ctx, tName.Schema)
840 if err != nil {
841 return "", false, err
842 }
843 a, err := tableMap.Get(ctx, tName.Name)
844 if err != nil {
845 return "", false, err
846 }
847 if !a.IsEmpty() {
848 return tName.Name, true, nil
849 }
850 found := false
851 resolvedName := tName.Name
852 err = tableMap.Iter(ctx, func(name string, addr hash.Hash) (bool, error) {
853 if !found && strings.EqualFold(tName.Name, name) {
854 resolvedName = name
855 found = true
856 }
857 return false, nil
858 })
859 if err != nil {
860 return "", false, nil
861 }
862 if found {
863 return resolvedName, true, nil
864 }
865 // Then check the root objects
866 resolvedTableName, _, objID, err := rootobject.ResolveName(ctx, root, tName)
867 if err != nil {
868 return "", false, err
869 }
870 return resolvedTableName.Name, objID != objinterface.RootObjectID_None, nil
871}
872
873// SetCollation implements the interface doltdb.RootValue.
874func (root *RootValue) SetCollation(ctx context.Context, collation schema.Collation) (doltdb.RootValue, error) {

Callers

nothing calls this directly

Calls 5

getTableMapMethod · 0.95
ResolveNameFunction · 0.92
GetMethod · 0.45
IsEmptyMethod · 0.45
IterMethod · 0.45

Tested by

no test coverage detected