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

Method GetTableInsensitive

server/tables/pg_database.go:167–184  ·  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

165// GetTableInsensitive overrides sqle.Database.GetTableInsensitive to check the pg_catalog
166// virtual schema before falling back to user tables.
167func (d *PgReadOnlyDatabase) GetTableInsensitive(ctx *sql.Context, tblName string) (sql.Table, bool, error) {
168 if resolve.UseSearchPath && d.ReadOnlyDatabase.Schema() == "" && strings.HasPrefix(strings.ToLower(tblName), "pg_") {
169 sdb, found, err := d.GetSchema(ctx, "pg_catalog")
170 if err != nil {
171 return nil, false, err
172 }
173 if found {
174 tbl, foundTbl, err := sdb.GetTableInsensitive(ctx, tblName)
175 if err != nil {
176 return nil, false, err
177 }
178 if foundTbl {
179 return tbl, true, nil
180 }
181 }
182 }
183 return d.ReadOnlyDatabase.GetTableInsensitive(ctx, tblName)
184}
185
186// ValidateNewIndexName implements the sql.SchemaObjectNameValidator interface
187func (d *PgDatabase) ValidateNewIndexName(ctx *sql.Context, newIndexName string, skipIfExists bool) (nameAlreadyUsed bool, err error) {

Callers

nothing calls this directly

Calls 3

GetSchemaMethod · 0.95
SchemaMethod · 0.65
GetTableInsensitiveMethod · 0.45

Tested by

no test coverage detected