A database object inside an SPL program may be referenced by the qualified name or by an unqualified name of the database object. A qualified name is in the form of schema.name where schema is the name of the schema under which the database object with identifier, name, exists. An unqualified name does not have the schema. portion. When a reference is made to a qualified name, there cannot be ambiguity as to exactly which database object is intended - it does or does not exist in the specified schema.

However, finding an object with an unqualified name requires the use of the search path of the current user. When a user becomes the current user of a session, a default search path is always associated with that user. The search path consists of a list of schemas, which are searched in left-to-right order for finding an unqualified database object reference. The object is considered non-existent if it cannot be found in any of the schemas in the search path. The default search path can be displayed in PSQL by using the SHOW search_path statement.

polardb=# SHOW search_path;
 "$user", public
(1 row)

$user in the above search path is a generic placeholder that refers to the current user. Therefore, if the current user of the above session is polardb, an unqualified database object would be searched for in the following schemas in this order - first, polardb, then public.

After an unqualified name has been resolved in the search path, it can be determined if the current user has the appropriate privilege to perform the action on that specific object.

Note The concept of the search path is not compatible with Oracle databases. For an unqualified reference, Oracle looks only in the schema of the current user for the named database object. Also note that in Oracle, a user and the schema of the user is the same entity while in PolarDB databases compatible with Oracle, a user and a schema are two distinct objects.