citus/src/backend/distributed/utils
Naisila Puka 61d11ec2d4
PG17 Compatibility - Fix HideCitusDependentObjects function (#7796)
There is a crash when running vanilla tests because of the
`citus.hide_citus_dependent_objects` GUC. We turn on this GUC only for
the pg vanilla tests. This GUC runs the following function
`HideCitusDependentObjectsOnQueriesOfPgMetaTables`. This function
doesn't take into account the new `mergeJoinCondition`. I rewrote the
function such that it checks for merge join conditions as well.

Relevant PG commit:
https://github.com/postgres/postgres/commit/0294df2f1

The crash could be reproduced locally like the following:
```SQL
SET citus.hide_citus_dependent_objects TO on;

CREATE OR REPLACE FUNCTION
    pg_catalog.is_citus_depended_object(oid,oid)
    RETURNS bool
    LANGUAGE C
    AS 'citus', $$is_citus_depended_object$$;

-- try a system catalog
MERGE INTO pg_class c
USING (SELECT 'pg_depend'::regclass AS oid) AS j
ON j.oid = c.oid
WHEN MATCHED THEN
UPDATE SET reltuples = reltuples + 1
RETURNING j.oid;

CREATE VIEW classv AS SELECT * FROM pg_class;

MERGE INTO classv c
USING pg_namespace n
ON n.oid = c.relnamespace
WHEN MATCHED AND c.oid = 'pg_depend'::regclass THEN
UPDATE SET reltuples = reltuples - 1
RETURNING c.oid;
-- crash happens here
```
2024-12-20 17:59:09 +03:00
..
acquire_lock.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
aggregate_utils.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
array_type.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
background_jobs.c Rename foreach_ macros to foreach_declared_ macros (#7700) 2024-10-16 17:01:39 +03:00
cancel_utils.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
citus_clauses.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
citus_copyfuncs.c Rename foreach_ macros to foreach_declared_ macros (#7700) 2024-10-16 17:01:39 +03:00
citus_depended_object.c PG17 Compatibility - Fix HideCitusDependentObjects function (#7796) 2024-12-20 17:59:09 +03:00
citus_nodefuncs.c PG17 compatibility: Resolve compilation issues (#7699) 2024-10-17 15:37:13 +03:00
citus_outfuncs.c move pg_version_constants.h to toplevel include (#7335) 2024-04-17 10:26:50 +02:00
citus_readfuncs.c Remove READFUNCs (#3536) 2020-02-24 12:43:28 +01:00
citus_safe_lib.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
citus_stat_tenants.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
citus_version.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
colocation_utils.c Rename foreach_ macros to foreach_declared_ macros (#7700) 2024-10-16 17:01:39 +03:00
directory.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
distribution_column.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
distribution_column_map.c Rename foreach_ macros to foreach_declared_ macros (#7700) 2024-10-16 17:01:39 +03:00
enable_ssl.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
errormessage.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
foreign_key_relationship.c Rename foreach_ macros to foreach_declared_ macros (#7700) 2024-10-16 17:01:39 +03:00
function.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
function_utils.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
hash_helpers.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
jsonbutils.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
listutils.c Rename foreach_ macros to foreach_declared_ macros (#7700) 2024-10-16 17:01:39 +03:00
log_utils.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
maintenanced.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
multi_partitioning_utils.c Rename foreach_ macros to foreach_declared_ macros (#7700) 2024-10-16 17:01:39 +03:00
namespace_utils.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
param_utils.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
priority.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
query_utils.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
reference_table_utils.c Rename foreach_ macros to foreach_declared_ macros (#7700) 2024-10-16 17:01:39 +03:00
relation_utils.c PG16 compatibility - Rework PlannedStmt and Query's Permission Info (#7098) 2023-08-09 15:23:00 +03:00
replication_origin_session_utils.c Add missing postgres.h includes 2024-04-17 10:26:50 +02:00
resource_lock.c Rename foreach_ macros to foreach_declared_ macros (#7700) 2024-10-16 17:01:39 +03:00
role.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
shard_utils.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
shardinterval_utils.c Rename foreach_ macros to foreach_declared_ macros (#7700) 2024-10-16 17:01:39 +03:00
statistics_collection.c Rename foreach_ macros to foreach_declared_ macros (#7700) 2024-10-16 17:01:39 +03:00
string_utils.c Degrade gracefully when no background workers available 2020-10-05 16:55:00 +03:00
task_execution_utils.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
tenant_schema_metadata.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
tuplestore.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00
type_utils.c Actually sort includes after cherry-pick 2024-04-17 10:26:50 +02:00