Create table exception related to search path (HGDB)

The database objects created by HGDB are related to the value of the variable search [u path]. When creating objects, if no mode is specified, these objects will be created in the default mode, which is called pubulic. One exception is that another pattern first appears in search [u path. The following problem is thrown when the default value of search path changes. Please refer to the following:

su - highgo
psql
highgo=# \c testdb 
PSQL: Release 4.1.1
Connected to:
HighGo Database V4.1 Enterprise Edition Release 4.1.1 - 64-bit Production

You are now connected to database "testdb" as user "user_t".

testdb=# CREATE TABLE  test(id integer not null);
ERROR:  3F000: no schema has been selected to create in
LINE 1: CREATE TABLE  test(id integer not null);
                      ^

There is an exception when creating the table. According to the general understanding, the table will be created in the default mode public. As a result, an error is reported here, indicating that there is no mode to choose when creating the table.

testdb=# create schema schema_t;
CREATE SCHEMA
testdb=# \dn
     List of schemas
      Name      | Owner  
----------------+--------
 hgdb_catalog   | highgo
 oracle_catalog | highgo
 public         | highgo
 schema_t       | user_t
(4 rows)

testdb=# CREATE TABLE  test(id integer not null);    --Create table object without specifying mode
CREATE TABLE
testdb=# \d
           List of relations
     Schema     | Name | Type  | Owner  
----------------+------+-------+--------
 oracle_catalog | dual | view  | highgo
 schema_t       | test | table | user_t
(2 rows)

testdb=# \dn
     List of schemas
      Name      | Owner  
----------------+--------
 hgdb_catalog   | highgo
 oracle_catalog | highgo
 public         | highgo
 schema_t       | user_t
(4 rows)

testdb=# select user;
 current_user 
--------------
 user_t
(1 row)

testdb=# show search_path;
 search_path 
-------------
 schema_t
(1 row)

Conclusion: after the above debugging, it is found that in the previous test, the value of serch [path] is modified to schema [t], and the schema is deleted in the database, resulting in the prompt that the database object cannot find the schema.

by polo

Keywords: Database

Added by etones on Sun, 03 May 2020 11:31:52 +0300