Skip to content

Commit

Permalink
address review comments:
Browse files Browse the repository at this point in the history
convert partition bounds to timestamp in show_partitions to ensure
that the result is time-ordered
  • Loading branch information
akulapid committed Sep 13, 2024
1 parent 7056aea commit c182d93
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sql/functions/show_partitions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CREATE FUNCTION @[email protected]_partitions (
DECLARE

v_control text;
v_time_encoder text;
v_time_decoder text;
v_control_type text;
v_exact_control_type text;
v_datetime_string text;
Expand All @@ -36,12 +36,12 @@ END IF;
SELECT partition_type
, datetime_string
, control
, time_encoder
, time_decoder
, epoch
INTO v_partition_type
, v_datetime_string
, v_control
, v_time_encoder
, v_time_decoder
, v_epoch
FROM @[email protected]_config
WHERE parent_table = p_parent_table;
Expand Down Expand Up @@ -99,7 +99,8 @@ IF v_control_type = 'time' THEN
ELSIF v_control_type IN ('text', 'uuid') THEN

v_sql := v_sql || format('
ORDER BY (regexp_match(pg_get_expr(c.relpartbound, c.oid, true), $REGEX$\(([^)]+)\) TO \(([^)]+)\)$REGEX$))[1] %s '
ORDER BY %s((regexp_match(pg_get_expr(c.relpartbound, c.oid, true), $REGEX$\(''([^)]+)''\) TO \(''([^)]+)''\)$REGEX$))[1]) %s '
, v_time_decoder
, p_order);

ELSIF v_control_type = 'id' AND v_epoch <> 'none' THEN
Expand Down

0 comments on commit c182d93

Please sign in to comment.