-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert partition bounds to timestamp in show_partitions to ensure that the result is time-ordered
- Loading branch information
Showing
1 changed file
with
5 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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; | ||
|
@@ -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 | ||
|