Updated on 2023-12-22 GMT+08:00

GAUSS-00501 -- GAUSS-00510

GAUSS-00501: "template database '%s' does not exist"

SQLSTATE: 3D000

Description: The template database template1 does not exist.

Solution: The template1 database is lost due to a database system exception. Restart the database or manually create the template1 database.

GAUSS-00502: "permission denied to copy database '%s'"

SQLSTATE: 42501

Description: In the syntax for creating a database, if the original database is not a template database, the user role does not have the permission to create a database.

Solution: In the syntax for creating a database, if the original database is not a template database, only users who have the CREATEDB permission or the system administrator can create a database. Ensure that the user has the required permission.

GAUSS-00503: "invalid server encoding %d"

SQLSTATE: 42809

Description: In the syntax for creating a database, the encoding format specified by ENCODING encoding is invalid.

Solution: In the syntax for creating a database, ensure that the encoding format specified by ENCODING encoding must be GBK, UTF8, or Latin1.

GAUSS-00504: "invalid locale name: '%s'"

SQLSTATE: 42809

Description: When you create a database, the specified database character set is invalid.

Solution: In the syntax for creating a database, ensure that the character set specified for the new database must match that of the template database. Use the show lc_collate; command to query the character set of the template database.

GAUSS-00505: "new encoding (%s) is incompatible with the encoding of the template database (%s)"

SQLSTATE: 22023

Description: In the syntax for creating a database, the character encoding specified for the new database does not match that of the template database template0.

Solution: In the syntax for creating a database, ensure that the character encoding specified for the new database must match that of the template database template0. Use the show server_encoding; command to query the character encoding of the template database template0. Then, modify the character encoding specified for the created database.

GAUSS-00506: "new collation (%s) is incompatible with the collation of the template database (%s)"

SQLSTATE: 22023

Description: In the syntax for creating a database, the character set specified for the new database does not match that of the template database template0.

Solution: In the syntax for creating a database, ensure that the character set specified for the new database matches that of the template database template0. Use the show lc_collate; command to query the character set of the template database template0. Then, modify the character set specified for the created database.

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
postgres=# \l
                                   List of databases
   Name    | Owner | Encoding |   Collate   |    Ctype    | Access privileges
-----------+-------+----------+-------------+-------------+-------------------
 postgres  | jack  | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 template0 | jack  | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/jack          +
           |       |          |             |             | jack=CTc/jack
 template1 | jack  | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/jack          +
           |       |          |             |             | jack=CTc/jack
(3 rows)

postgres=# create database testdb LC_COLLATE='zh_CN.utf8';
ERROR:  new collation (zh_CN.utf8) is incompatible with the collation of the template database (en_US.UTF-8)
HINT:  Use the same collation as in the template database, or use template0 as template.

GAUSS-00507: "new LC_CTYPE (%s) is incompatible with the LC_CTYPE of the template database (%s)"

SQLSTATE: 22023

Description: In the syntax for creating a database, the character type specified for the new database does not match that of the template database template0.

Solution: In the syntax for creating a database, ensure that the character type specified for the new database matches that of the template database template0. Use the show lc_ctype; command to query the character type of the template database template0. Then, modify the character type specified for the created database.

GAUSS-00508: "pg_global cannot be used as default tablespace"

SQLSTATE: 22023

Description: In the syntax for creating a database, the default tablespace specified for the new database is pg_global.

Solution: In the syntax for creating a database, ensure that the default tablespace specified for the new database is not pg_global. Currently, only the default tablespace is supported.

GAUSS-00509: "cannot assign new default tablespace '%s'"

SQLSTATE: 0A000

Description: In the syntax for creating a database, the default tablespace specified for the new database is pg_global.

Solution: In the syntax for creating a database, ensure that the directory for the tablespace is valid when specifying a tablespace other than the default tablespace and the global tablespace for the new tablespace. If the directory is invalid, create a valid directory.

GAUSS-00510: "database '%s' already exists"

SQLSTATE: 42P04

Description: The database to be created already exists.

Solution: Use the \l command to check whether the database to be created exists. If yes, create a database that does not exist.