Fix assignment operator bug in DESC order partition data functions #829
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.
Fixes #828
Problem
The
partition_data_procfunction failed when called withp_order := 'DESC'and ap_intervalparameter, causing errors like:ERROR: relation "my_table_p20251105" does not exist
Root Cause
The code incorrectly used
=(comparison operator) instead of:=(assignment operator) in PL/pgSQL. This caused variable assignments to be evaluated as boolean comparisons and discarded, rather than actually updating thevariables.
Solution
Changed all affected instances of
=to:=for proper variable assignments in:partition_data_time.sqlline 252:v_min_partition_timestampassignment for DESC order with batch intervalspartition_data_id.sqllines 154, 168, 174:v_min_partition_idassignments for both ASC and DESC orderTesting
The fix ensures that when using DESC order, the partition boundary calculations correctly respect the partition interval (e.g., monthly) rather than defaulting to incorrect daily boundaries.