Help Center/ GaussDB(DWS)/ Troubleshooting/ Database Use/ Case Sensitivity in SQL Statements
Updated on 2024-03-08 GMT+08:00

Case Sensitivity in SQL Statements

Symptom

The table01 table contains the ColumnA field. When the SELECT statement is executed, the system displays a message indicating that the field does not exist and reports column "columna" does not exist.

1
2
3
4
5
select ColumnA from table01 limit 100;
ERROR:  column "columna" does not exist
LINE 1: select columna from TABLE_01;
               ^
CONTEXT:  referenced column: columna

Possible Causes

Table field names in SQL statements are case-sensitive if they are enclosed with double quotation marks. Otherwise, they are case-insensitive (are regarded as lowercase letters).

Handling Procedure

  • Delete the double quotation marks from the field name if you want it case-insensitive.
  • Otherwise, add the double quotation marks to the field names.

    The following is an example:

    In table01, when you use the SELECT statement to query ColumnA, add double quotation marks. The query will be successful.

    1
    select "ColumnA" from table01 limit 100;