PG17 compatibility: fix multi-1 diffs caused by PG17 optimizer enhancements #7769
+35
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fix restores the expected DEBUG error messages from the router planner in
multi_router_planner
,multi_router_planner_fast_path
andquery_single_shard_table
. In the case ofquery_single_shard_table
the diffs are because of this PG17 commit, which enables the optimizer to pull up a correlated ANY subquery to a join. The fix inhibits subquery pull up by including a volatile function in the predicate involving the ANY subquery.In the case of
multi_router_planner
andmulti_router_planner_fast_path
the diffs are because of this PG17 commit, which enables the optimizer to detect and remove redundant IS (NOT) NULL expressions. The fix is to adjust the table definition so the column used for distribution is not marked NOT NULL, thus preserving .Finallly, the DEBUG logging level is lowered for CREATE MATERIALIZED VIEW AS statements in
multi_router_planner
andmulti_router_planner_fast_path
because of this PG17 commit; when creating materialized views, use REFRESH logic to load data. A consequence of this is that withclient_min_messages
atDEBUG2
the following is emitted for CREATE MATERIALIZED VIEW AS statements:drop auto-cascades to type multi_router_planner.pg_temp_42245
. This is part of the REFRESH logic, and also relevant is this PG17 commit which sets the search_path to 'pg_catalog, pg_temp' during maintenance operations (including REFRESH MATERIALIZED VIEW)