Home >Database >Mysql Tutorial >Why Does My PostgreSQL Query Fail with 'Column \'Continent\' Does Not Exist' Despite the Column Existing?
PostgreSQL database error: Column 'Continent' does not exist
Problem background:
A Java application encountered an error when querying the database that the column "Continent" did not exist in a specific table, despite confirming that the column existed in pgAdmin 4. The query attempts to select non-null values from this column.
Problem Diagnosis:
Solution:
Fix this issue by surrounding the column names in double quotes in the query:
<code class="language-sql">SELECT "Continent" FROM network.countries ...</code>
PostgreSQL requires that column names must be enclosed in double quotes when they contain special characters or conflict with keywords. In this case, "Continent" is a reserved keyword in PostgreSQL, so it needs to be enclosed in quotes.
Additional notes:
The above is the detailed content of Why Does My PostgreSQL Query Fail with 'Column \'Continent\' Does Not Exist' Despite the Column Existing?. For more information, please follow other related articles on the PHP Chinese website!