Skip to content

Remove citus.enable_unsafe_statistics_expressions GUC and always enable the feature#8512

Merged
onurctirtir merged 5 commits intomainfrom
copilot/remove-guc-and-enable-feature
Mar 13, 2026
Merged

Remove citus.enable_unsafe_statistics_expressions GUC and always enable the feature#8512
onurctirtir merged 5 commits intomainfrom
copilot/remove-guc-and-enable-feature

Conversation

@onurctirtir
Copy link
Copy Markdown
Member

Removing the GUC introduced at #8501 as it's not needed at all.

Copilot AI and others added 5 commits March 13, 2026 07:43
@onurctirtir onurctirtir enabled auto-merge (squash) March 13, 2026 08:41
@onurctirtir onurctirtir merged commit 84ddcd9 into main Mar 13, 2026
158 checks passed
@onurctirtir onurctirtir deleted the copilot/remove-guc-and-enable-feature branch March 13, 2026 08:46
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.91%. Comparing base (ad2140d) to head (58e4142).
⚠️ Report is 1 commits behind head on main.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_expressions GUC and its backing variable/extern.
  • Always transforms/deparses expression stats elements when generating propagated CREATE STATISTICS commands.
  • 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);
onurctirtir added a commit that referenced this pull request Mar 13, 2026
…le the feature (#8512)

Removing the GUC introduced at
#8501 as it's not needed at all.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: onurctirtir <16804727+onurctirtir@users.noreply.github.com>
(cherry picked from commit 84ddcd9)
onurctirtir added a commit that referenced this pull request Mar 13, 2026
…le the feature (#8512)

Removing the GUC introduced at
#8501 as it's not needed at all.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: onurctirtir <16804727+onurctirtir@users.noreply.github.com>
(cherry picked from commit 84ddcd9)
onurctirtir added a commit that referenced this pull request Mar 13, 2026
…le the feature (#8512)

Removing the GUC introduced at
#8501 as it's not needed at all.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: onurctirtir <16804727+onurctirtir@users.noreply.github.com>
(cherry picked from commit 84ddcd9)
onurctirtir added a commit that referenced this pull request Mar 13, 2026
…le the feature (#8512)

Removing the GUC introduced at
#8501 as it's not needed at all.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: onurctirtir <16804727+onurctirtir@users.noreply.github.com>
(cherry picked from commit 84ddcd9)
onurctirtir added a commit that referenced this pull request Mar 13, 2026
…le the feature (#8512)

Removing the GUC introduced at
#8501 as it's not needed at all.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: onurctirtir <16804727+onurctirtir@users.noreply.github.com>
(cherry picked from commit 84ddcd9)
onurctirtir added a commit that referenced this pull request Mar 13, 2026
…le the feature (#8512)

Removing the GUC introduced at
#8501 as it's not needed at all.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: onurctirtir <16804727+onurctirtir@users.noreply.github.com>
onurctirtir added a commit that referenced this pull request Mar 13, 2026
…le the feature (#8512)

Removing the GUC introduced at
#8501 as it's not needed at all.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: onurctirtir <16804727+onurctirtir@users.noreply.github.com>
(cherry picked from commit 84ddcd9)
onurctirtir added a commit that referenced this pull request Mar 13, 2026
…le the feature (#8512)

Removing the GUC introduced at
#8501 as it's not needed at all.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: onurctirtir <16804727+onurctirtir@users.noreply.github.com>
(cherry picked from commit 84ddcd9)
onurctirtir added a commit that referenced this pull request Mar 13, 2026
…le the feature (#8512)

Removing the GUC introduced at
#8501 as it's not needed at all.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: onurctirtir <16804727+onurctirtir@users.noreply.github.com>
(cherry picked from commit 84ddcd9)
onurctirtir added a commit that referenced this pull request Mar 13, 2026
…le the feature (#8512)

Removing the GUC introduced at
#8501 as it's not needed at all.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: onurctirtir <16804727+onurctirtir@users.noreply.github.com>
(cherry picked from commit 84ddcd9)
onurctirtir added a commit that referenced this pull request Mar 13, 2026
…le the feature (#8512)

Removing the GUC introduced at
#8501 as it's not needed at all.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: onurctirtir <16804727+onurctirtir@users.noreply.github.com>
(cherry picked from commit 84ddcd9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants