mirror of https://github.com/citusdata/citus.git
When re-writing query tree, postgres combines multiple subscripting operators referencing to the same attribute into a single `TargetEntry` by linking `SubscriptingRef` objects to each other via their `refexpr` fields. (See `rewriteTargetListIU` & `process_matched_tle` functions.) However, ruleutils function `get_update_query_targetlist_def` doesn't know how to properly deparse such a `TargetEntry`. As a result, we were only taking the last set-by-subscript operation into account when generating the shard query for such an `UPDATE` command. In postgres, this doesn't cause any problems (e.g.: when generating definition of a rule based object) since the query-rewrite transformations aren't performed on the query tree that `get_update_query_targetlist_def` is expected to process. For this reason; with this commit, before processing the target entry list in our ruleutils based deparser, we first expand such target entries into multiple ones. To detect such `SubscriptingRef` objects, we also need to investigate `FieldStore` and `CoerceToDomain` objects as postgres functions processing `SubscriptingRef` objects do --although they do so for different purposes. However, given that Citus already doesn't allow `INSERT/UPDATE` via `FieldStore`, we only do that for `CoerceToDomain` objects. |
||
---|---|---|
.. | ||
citus_ruleutils.c | ||
deparse.c | ||
deparse_attribute_stmts.c | ||
deparse_collation_stmts.c | ||
deparse_database_stmts.c | ||
deparse_extension_stmts.c | ||
deparse_foreign_server_stmts.c | ||
deparse_function_stmts.c | ||
deparse_role_stmts.c | ||
deparse_schema_stmts.c | ||
deparse_sequence_stmts.c | ||
deparse_statistics_stmts.c | ||
deparse_table_stmts.c | ||
deparse_type_stmts.c | ||
format_collate.c | ||
objectaddress.c | ||
qualify.c | ||
qualify_collation_stmt.c | ||
qualify_function_stmt.c | ||
qualify_role_stmt.c | ||
qualify_sequence_stmt.c | ||
qualify_statistics_stmt.c | ||
qualify_table_stmt.c | ||
qualify_type_stmt.c | ||
ruleutils_12.c | ||
ruleutils_13.c | ||
ruleutils_14.c |