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

Function SearchPath

core/context.go:264–285  ·  view source on GitHub ↗

SearchPath returns the effective schema search path for the current session

(ctx *sql.Context)

Source from the content-addressed store, hash-verified

262
263// SearchPath returns the effective schema search path for the current session
264func SearchPath(ctx *sql.Context) ([]string, error) {
265 path, err := resolve.SearchPath(ctx)
266 if err != nil {
267 return nil, err
268 }
269
270 // pg_catalog is *always* implicitly part of the search path as the first element, unless it's specifically
271 // included later. This allows users to override built-in names with user-defined names, but they have to
272 // opt in to that behavior.
273 hasPgCatalog := false
274 for _, schema := range path {
275 if schema == "pg_catalog" {
276 hasPgCatalog = true
277 break
278 }
279 }
280
281 if !hasPgCatalog {
282 path = append([]string{"pg_catalog"}, path...)
283 }
284 return path, nil
285}
286
287// GetExtensionsCollectionFromContext returns the extensions collection from the given context. Will always return a
288// collection if no error is returned.

Callers 5

regclass.goFile · 0.92
loadFunctionFunction · 0.92
GetSqlTableFromContextFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected