citus/src/backend/distributed/deparser
Onur Tirtir dc293964bf Expand target entries with merged array/jsonb subscripting ops into multiple ones
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.
2022-02-09 12:53:23 +03:00
..
citus_ruleutils.c Expand target entries with merged array/jsonb subscripting ops into multiple ones 2022-02-09 12:53:23 +03:00
deparse.c Introduce GetDistributeObjectOps to organize dispatch of logic dependent on node/object type 2020-01-09 18:24:29 +00:00
deparse_attribute_stmts.c Introduce GetDistributeObjectOps to organize dispatch of logic dependent on node/object type 2020-01-09 18:24:29 +00:00
deparse_collation_stmts.c Introduce GetDistributeObjectOps to organize dispatch of logic dependent on node/object type 2020-01-09 18:24:29 +00:00
deparse_database_stmts.c Feature: alter database owner (#4986) 2021-05-20 13:27:44 +02:00
deparse_extension_stmts.c Refactor the deparsing of a CREATE EXTENSION to prevent NULL POINTER dereferences (#3518) 2020-03-04 16:47:07 +01:00
deparse_foreign_server_stmts.c Propagate foreign server ops 2021-12-23 17:54:04 +03:00
deparse_function_stmts.c Propagate ALTER ROLE .. SET statements 2020-03-27 13:02:48 +03:00
deparse_role_stmts.c Fixes function names in comments 2021-10-06 09:24:43 +03:00
deparse_schema_stmts.c Propagate create statistics 2020-12-17 20:38:36 +03:00
deparse_sequence_stmts.c Adds AlterTableStmtObjType macro 2021-09-03 15:27:24 +03:00
deparse_statistics_stmts.c Make pg_version_compat.h and listutils.c dependency-free. (#5548) 2022-01-04 23:02:08 -08:00
deparse_table_stmts.c Support foreign tables in MX (#5461) 2022-01-06 18:50:34 +03:00
deparse_type_stmts.c Adds AlterTableStmtObjType macro 2021-09-03 15:27:24 +03:00
format_collate.c Remove unused functions that cppcheck found 2020-10-19 13:50:52 +03:00
objectaddress.c Remove unused functions that cppcheck found 2020-10-19 13:50:52 +03:00
qualify.c Introduce GetDistributeObjectOps to organize dispatch of logic dependent on node/object type 2020-01-09 18:24:29 +00:00
qualify_collation_stmt.c Introduce GetDistributeObjectOps to organize dispatch of logic dependent on node/object type 2020-01-09 18:24:29 +00:00
qualify_function_stmt.c Propagate DROP ROUTINE, ALTER ROUTINE 2020-01-13 15:37:46 +00:00
qualify_role_stmt.c Accept list of values in a supported ALTER ROLE .. SET statement 2020-07-21 03:49:57 +03:00
qualify_sequence_stmt.c Adds AlterTableStmtObjType macro 2021-09-03 15:27:24 +03:00
qualify_statistics_stmt.c Fixes function names in comments 2021-10-06 09:24:43 +03:00
qualify_table_stmt.c Support foreign tables in MX (#5461) 2022-01-06 18:50:34 +03:00
qualify_type_stmt.c Adds AlterTableStmtObjType macro 2021-09-03 15:27:24 +03:00
ruleutils_12.c Expand target entries with merged array/jsonb subscripting ops into multiple ones 2022-02-09 12:53:23 +03:00
ruleutils_13.c Expand target entries with merged array/jsonb subscripting ops into multiple ones 2022-02-09 12:53:23 +03:00
ruleutils_14.c Expand target entries with merged array/jsonb subscripting ops into multiple ones 2022-02-09 12:53:23 +03:00