Postgres: Overcoming "Column Does Not Exist" Error in WHERE IN (List) Query
In Postgres, executing a query featuring a WHERE IN (list) clause can sometimes result in an unexpected error message: "column does not exist." To resolve this issue, it's crucial to understand the underlying principles and make necessary adjustments.
In the given query, the error occurs because the values within the list are surrounded by double quotes, which is typically used for table and column identifiers. However, for string constants, single quotes must be used.
To rectify this, the query should be rewritten as follows:
DELETE FROM user_job_titles WHERE id IN ('c836d018-1d12-4507-a268-a4d80d6d3f54', 'd0961a90-7d31-4c4c-9c1b-671115e3d833', '62dda420-6e62-4017-b41d-205c0aa82ead' );
By replacing double quotes with single quotes for string constants, the query will correctly identify the specified id values and execute the deletion operation smoothly.
The above is the detailed content of Postgres WHERE IN Clause Error: Why 'Column Does Not Exist'?. For more information, please follow other related articles on the PHP Chinese website!