SearchPath
A session's search_path, read from what the server reports, and the order the server looks a type name up in.
The report is the setting's text, which is not the path the server searches. SET normalizes what it is given before storing it, but set_config and a startup parameter store the text as written, so Gallia arrives as Gallia and means gallia. The setting also names schemas by alias - $user, pg_temp - and leaves out the ones searched without being listed. Both halves are worked out here the way namespace.c works them out.
What the server knows and does not report, this cannot follow:
$useris the current role, andSET ROLEmoves it without aParameterStatus(roleis not reported in PostgreSQL 18). It is taken fromsession_authorization, whichSET SESSION AUTHORIZATIONdoes report.A listed schema the current role has no
USAGEon is skipped by the server and kept here.The session's temporary schema is a
pg_temp_Ncreated with its first temporary object, and reported nowhere. The server searches it ahead of everything else for type names,pg_catalogincluded, or wherepg_tempstands in the setting; it is left out here either way.
Properties
The setting's entries, split as the server splits them: an unquoted name folded to lower case, a quoted one unquoted, every name cut to MAX_NAME_BYTES. $user and pg_temp stay as they are.
the reported session_authorization, which $user stands for, or null where none was.
The schemas an unqualified type name is looked up in, first match winning: entries with $user as sessionUser, or without it where there is none, without pg_temp, and with pg_catalog ahead of them unless they list it.