citus
citus copied to clipboard
bad rewriting of query involving targetList indirection: "UPDATE SET (col2, col1, col3)"
A customer reported a bug from development team affecting queries with UPDATE SET (col2, col1, col3) = (.....)
The columns are reordered following their physical ordering in pg_attribute, leading to for example UPDATE SET (col1, col2, col3) = (.....)
with the right part, after =
unchanged, as a results wrong columns are updated...
I have a complete test case, and a PR which I'm going to link in a moment. I think the issue may affect silently many applications, even more because the behavior can change over time based on the DDL applied on the updated tables.
There are several issue, I'm going to collect what I fond and link here so maybe we can close several at once...
Please see https://github.com/citusdata/citus/actions/runs/10527721147#summary-29171656391 for some examples of the problem.