Help Center/ GaussDB/ Developer Guide(Distributed_V2.0-8.x)/ FAQs/ Why Cannot the Table Name or Column Name Be Identified During Query?
Updated on 2025-05-29 GMT+08:00

Why Cannot the Table Name or Column Name Be Identified During Query?

Answer: The most common cause is that the table name or column name is enclosed in double quotation marks (") during the creation. When double quotation marks are used, table names and column names (called identifiers) are case-sensitive in storage. Therefore, double quotation marks must be used during query and the case must match that during creation. Some APIs or applications automatically introduce double quotation marks when they are created. Therefore, you are advised to use lowercase letters when creating APIs or applications.

Example:

-- Create a table.
gaussdb=# CREATE TABLE "TB_test" ("Tid" int, num int);

-- If double quotation marks are not added when a table is queried, lowercase letters are used by default. As a result, an error is reported.
gaussdb=# SELECT * FROM TB_test;
ERROR:  relation "tb_test" does not exist
LINE 1: SELECT * FROM TB_test;

gaussdb=# SELECT Tid FROM "TB_test";
ERROR:  Column "tid" does not exist
LINE 1: SELECT Tid FROM "TB_test"

-- Add double quotation marks during query.
gaussdb=# SELECT "Tid"  FROM  "TB_test";
 Tid 
-----
(0 rows)

-- Drop the table.
gaussdb=# DROP TABLE "TB_test";