PostgREST error: 400 'column example_table.example_column does not exist' when using OR operators #47412
Replies: 1 comment
-
|
Thanks for documenting this issue. I ran into similar behavior where the same One thing I'd recommend to anyone debugging this is to first verify whether the query succeeds as a The |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This is a copy of a troubleshooting article on Supabase's docs site. It may be missing some details from the original. View the original article.
If you receive a
400error with the messagecolumn example_table.example_column does not existonly on mutation requests (PATCH,POST,DELETE) — whileSELECTqueries on the same column work fine — this is a known bug in PostgREST versions before 14.4 (issue #3707).Root cause
The bug is triggered when an
or()filter is included in a mutation request. PostgREST incorrectly applies the OR filter's column resolution logic to the mutation plan, causing it to fail to locate columns that exist and are otherwise accessible.How to confirm
GETrequest. If it succeeds but thePATCH/POST/DELETEfails with the same column reference, the bug is the likely cause.column "example_column" does not existerrors correlating with the timestamps of the failed mutation requests.Resolution
Option 1: Upgrade (permanent fix)
Navigate to Project Settings > Infrastructure and upgrade to the latest Postgres version. This automatically upgrades PostgREST to 14.5+, where the bug is resolved.
Option 2: Query workaround (immediate)
Explicitly include the column referenced in the error in the
selectparameter of your mutation request. This forces PostgREST to resolve the column correctly during the mutation plan.For example, if your request looks like:
Add
select=with the affected column:This workaround applies per-request and does not require any schema changes or infrastructure modifications.
Beta Was this translation helpful? Give feedback.
All reactions