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. In this form, schema specifies the name of the schema. In this schema, the database object whose identifier is name exists. An unqualified name does not have the schema. part. When a qualified name is referenced, the intended specific database object cannot be ambiguous. To be specific, the database object exists or does not exist in the specified schema.

However, if an unqualified name is used to find an object, the search path of the current user must be used. When a user becomes the current user of a session, the default search path is always associated with this user. The search path consists of a list of schemas. The schemas are searched in left-to-right order to locate an unqualified database object reference. If the object cannot be found in a schema in the search path, the object does not exist. You can run the SHOW search_path command in PSQL to display the default search path.

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

$user in the preceding search path specifies a general placeholder of the current user. Therefore, if the current user of the preceding session is polardb, an unqualified database object is searched for in the following schemas: polardb and public. polardb takes precedence over public.

After an unqualified name is resolved in the search path, the system determines whether the current user has the appropriate privilege to perform a required operation on this specific object.

Note The concept of the search path is not compatible with Oracle databases. For an unqualified reference, Oracle searches the schema of only the current user for the specified database object. Take note of the following item: A user and its schema are the same entity in Oracle, but a user and a schema are two different objects in PolarDB O Edition.