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

Method GetTableInsensitive

server/tables/pg_database.go:105–122  ·  view source on GitHub ↗

GetTableInsensitive overrides sqle.Database.GetTableInsensitive to check the pg_catalog virtual schema before falling back to user tables.

(ctx *sql.Context, tblName string)

Source from the content-addressed store, hash-verified

103// GetTableInsensitive overrides sqle.Database.GetTableInsensitive to check the pg_catalog
104// virtual schema before falling back to user tables.
105func (d *PgDatabase) GetTableInsensitive(ctx *sql.Context, tblName string) (sql.Table, bool, error) {
106 if resolve.UseSearchPath && d.Database.Schema() == "" && strings.HasPrefix(strings.ToLower(tblName), "pg_") {
107 sdb, found, err := d.GetSchema(ctx, "pg_catalog")
108 if err != nil {
109 return nil, false, err
110 }
111 if found {
112 tbl, foundTbl, err := sdb.GetTableInsensitive(ctx, tblName)
113 if err != nil {
114 return nil, false, err
115 }
116 if foundTbl {
117 return tbl, true, nil
118 }
119 }
120 }
121 return d.Database.GetTableInsensitive(ctx, tblName)
122}
123
124// DropTable overrides sqle.Database.DropTable to prevent dropping virtual pg_catalog tables.
125func (d *PgDatabase) DropTable(ctx *sql.Context, tableName string) error {

Callers 3

DropTableMethod · 0.45
GetTableInsensitiveMethod · 0.45
doesRelationExistMethod · 0.45

Calls 2

GetSchemaMethod · 0.95
SchemaMethod · 0.65

Tested by

no test coverage detected