Fix datetime parse error in chunk constraint creation

With certain timezone settings chunk constraint creation could
fail as we convert the internal time to string when creating
the chunk constraint leading to parse errors when the produces
string could not be parsed back.
This commit is contained in:
Sven Klemm 2024-11-07 07:46:11 +01:00 committed by Sven Klemm
parent 98780f7d59
commit 7faf5f772e
2 changed files with 10 additions and 1 deletions

1
.unreleased/pr_7426 Normal file
View File

@ -0,0 +1 @@
Fixes: #7426 Fix datetime parsing error in chunk constraint creation

View File

@ -330,9 +330,17 @@ create_dimension_check_constraint(const Dimension *dim, const DimensionSlice *sl
enddat = ts_internal_to_time_value(slice->fd.range_end, dim->fd.column_type);
}
/* Convert internal format datums to string (output) datums */
/*
* Convert internal format datums to string (output) datums.
*
* We are forcing ISO datestyle here to prevent parsing errors with
* certain timezone/datestyle combinations.
*/
int current_datestyle = DateStyle;
DateStyle = USE_ISO_DATES;
startdat = OidFunctionCall1(outfuncid, startdat);
enddat = OidFunctionCall1(outfuncid, enddat);
DateStyle = current_datestyle;
/* Elide range constraint for +INF or -INF */
if (slice->fd.range_start != PG_INT64_MIN)