Skip to content

Commit

Permalink
remove redundant code for func epoch in create_partition_time
Browse files Browse the repository at this point in the history
  • Loading branch information
calebj committed Jan 7, 2025
1 parent 64940d8 commit 5d85138
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions sql/functions/create_partition_time.sql
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ v_sub_timestamp_max timestamptz;
v_sub_timestamp_min timestamptz;
v_template_table text;
v_time timestamptz;
v_partition_id_start bigint;
v_partition_id_end bigint;
v_partition_text_start text;
v_partition_text_end text;

Expand Down Expand Up @@ -221,7 +219,7 @@ FOREACH v_time IN ARRAY p_partition_times LOOP
PERFORM @[email protected]_template_properties(p_parent_table, v_parent_schema, v_partition_name);
END IF;

IF v_epoch = 'none' THEN
IF v_epoch IN ('none', 'func') THEN
-- Attach with normal, time-based values for built-in constraint
IF v_time_encoder IS NULL THEN
EXECUTE format('ALTER TABLE %I.%I ATTACH PARTITION %I.%I FOR VALUES FROM (%L) TO (%L)'
Expand All @@ -243,17 +241,6 @@ FOREACH v_time IN ARRAY p_partition_times LOOP
, v_partition_text_start
, v_partition_text_end);
END IF;
ELSIF v_epoch = 'func' THEN
EXECUTE format('SELECT %s(%L)', v_time_encoder, v_partition_timestamp_start) INTO v_partition_id_start;
EXECUTE format('SELECT %s(%L)', v_time_encoder, v_partition_timestamp_end) INTO v_partition_id_end;

EXECUTE format('ALTER TABLE %I.%I ATTACH PARTITION %I.%I FOR VALUES FROM (%L) TO (%L)'
, v_parent_schema
, v_parent_tablename
, v_parent_schema
, v_partition_name
, v_partition_id_start
, v_partition_id_end);
ELSE
-- Must attach with integer based values for built-in constraint and epoch
IF v_epoch = 'seconds' THEN
Expand Down

0 comments on commit 5d85138

Please sign in to comment.