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

Method Next

postgres/parser/sessiondata/search_path.go:227–262  ·  view source on GitHub ↗

Next returns the next search path, or false if there are no remaining paths.

()

Source from the content-addressed store, hash-verified

225
226// Next returns the next search path, or false if there are no remaining paths.
227func (iter *SearchPathIter) Next() (path string, ok bool) {
228 // If the session specific temporary schema has not been created, we can
229 // preempt the name resolution failure by simply skipping the implicit pg_temp.
230 if iter.implicitPgTempSchema && iter.tempSchemaName != "" {
231 iter.implicitPgTempSchema = false
232 return iter.tempSchemaName, true
233 }
234 if iter.implicitPgCatalog {
235 iter.implicitPgCatalog = false
236 return PgCatalogName, true
237 }
238
239 if iter.i < len(iter.paths) {
240 iter.i++
241 // If pg_temp is explicitly present in the paths, it must be resolved to the
242 // session specific temp schema (if one exists). tempSchemaName is set in the
243 // iterator iff the session has created a temporary schema.
244 if iter.paths[iter.i-1] == PgTempSchemaName {
245 // If the session specific temporary schema has not been created we can
246 // preempt the resolution failure and iterate to the next entry.
247 if iter.tempSchemaName == "" {
248 return iter.Next()
249 }
250 return iter.tempSchemaName, true
251 }
252 // pg_extension should be read before delving into the schema.
253 if iter.paths[iter.i-1] == PublicSchemaName && iter.implicitPgExtension {
254 iter.implicitPgExtension = false
255 // Go back one so `public` can be found again next.
256 iter.i--
257 return PgExtensionSchemaName, true
258 }
259 return iter.paths[iter.i-1], true
260 }
261 return "", false
262}

Callers 4

jsonNodeMethod · 0.45
ResolveExistingFunction · 0.45
ResolveTargetFunction · 0.45
ResolveMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected