Skip to content

Commit

Permalink
Force DateStyle and DateOrder in materialization
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziomello committed Oct 4, 2024
1 parent 82edcf1 commit 7dfe6b8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tsl/src/continuous_aggs/materialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,25 @@ spi_update_watermark(Hypertable *mat_ht, SchemaAndName materialization_table,
}
}

static int SavedDateStyle;
static int SavedDateOrder;

static inline void
set_date_config(int newDateStyle, int newDateOrder)
{
SavedDateStyle = DateStyle;
SavedDateOrder = DateOrder;
DateStyle = newDateStyle;
DateOrder = newDateOrder;
}

static inline void
unset_date_config()
{
DateStyle = SavedDateStyle;
DateOrder = SavedDateOrder;
}

static void
spi_update_materializations(Hypertable *mat_ht, const ContinuousAgg *cagg,
SchemaAndName partial_view, SchemaAndName materialization_table,
Expand All @@ -383,8 +402,10 @@ spi_update_materializations(Hypertable *mat_ht, const ContinuousAgg *cagg,
uint64 rows_processed = 0;

getTypeOutputInfo(invalidation_range.type, &out_fn, &type_is_varlena);
set_date_config(USE_ISO_DATES, DATEORDER_YMD);
invalidation_start = OidOutputFunctionCall(out_fn, invalidation_range.start);
invalidation_end = OidOutputFunctionCall(out_fn, invalidation_range.end);
unset_date_config();

/* MERGE statement is available starting on PG15 and we'll support it only in the new format of
* CAggs and for non-compressed hypertables */
Expand Down

0 comments on commit 7dfe6b8

Please sign in to comment.