Remove citus.enable_unsafe_statistics_expressions GUC and always enable the feature#8512
Merged
onurctirtir merged 5 commits intomainfrom Mar 13, 2026
Merged
Conversation
…ure by default Co-authored-by: onurctirtir <16804727+onurctirtir@users.noreply.github.com>
emelsimsek
approved these changes
Mar 13, 2026
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8512 +/- ##
=======================================
Coverage 88.91% 88.91%
=======================================
Files 286 286
Lines 63133 63129 -4
Branches 7915 7914 -1
=======================================
+ Hits 56132 56134 +2
+ Misses 4732 4728 -4
+ Partials 2269 2267 -2 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Removes the citus.enable_unsafe_statistics_expressions GUC and makes expression-based CREATE STATISTICS propagation to shards always enabled, updating deparsing logic and regression tests accordingly.
Changes:
- Deletes the
citus.enable_unsafe_statistics_expressionsGUC and its backing variable/extern. - Always transforms/deparses expression stats elements when generating propagated
CREATE STATISTICScommands. - Updates regression SQL and expected outputs to reflect expression stats now succeeding without toggling a GUC.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/backend/distributed/deparser/deparse_statistics_stmts.c | Removes GUC gate; always transforms/deparses stats expressions. |
| src/backend/distributed/shared_library_init.c | Removes registration of the GUC. |
| src/include/distributed/commands.h | Removes EnableUnsafeStatisticsExpressions extern. |
| src/test/regress/sql/propagate_statistics.sql | Updates tests to stop toggling GUC and to expect success. |
| src/test/regress/sql/pg14.sql | Updates pg14 regression scenario/comments for CREATE STATISTICS. |
| src/test/regress/expected/propagate_statistics.out | Updates expected output to remove prior error and GUC toggles. |
| src/test/regress/expected/pg14.out | Updates expected output to remove prior error for expression stats. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| reindex(TABLESPACE test_tablespace1) index idx; | ||
| reset citus.log_remote_commands; | ||
| -- CREATE STATISTICS only allow simple column references | ||
| -- CREATE STATISTICS allows table references too |
| /* Add table name to the name space in parse state. Otherwise column names | ||
| * cannot be found. | ||
| */ | ||
| Relation relation = table_open(relOid, AccessShareLock); |
Comment on lines
+311
to
+312
|
|
||
| char *exprSql = deparse_expression(exprCooked, relationCtx, false, false); |
| ParseState *pstate = make_parsestate(NULL); | ||
| AddRangeTableEntryToQueryCompat(pstate, relation); | ||
| Node *exprCooked = transformExpr(pstate, column->expr, | ||
| EXPR_KIND_STATS_EXPRESSION); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Removing the GUC introduced at #8501 as it's not needed at all.