Help Center/ Database and Application Migration UGO/ FAQs/ Evaluation Project/ In GaussDB, How Do I Configure a Search Path If A Statement Without Schema Name Fails To Be Executed?
Updated on 2023-07-25 GMT+08:00

In GaussDB, How Do I Configure a Search Path If A Statement Without Schema Name Fails To Be Executed?

You can execute the following command in GaussDB to see if the aa table exists.

create schema sch1;

create table sch1.aa(col int);

select * from aa;

If it does not exist, the actual error message is as follows: -ERROR: The table aa does not exist.

LINE 1: select * from aa;

^

SQL state: 42P01

Character: 15

This is because there is no sch1 in the search path.

Run following statement to add sch1 to the search path:

set search_path = "$user",public,sch1;

Run the SELECT statement.

select * from aa;

In this case, no error occurs.

To obtain the current search_path, run the following statement:

show search_path;