mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Revert "Disallow infinite endpoints in generate_series() for timestamps."
This reverts commit eafdf9de06
and its back-branch counterparts. Corey Huinker pointed out that
we'd discussed this exact change back in 2016 and rejected it,
on the grounds that there's at least one usage pattern with LIMIT
where an infinite endpoint can usefully be used. Perhaps that
argument needs to be re-litigated, but there's no time left before
our back-branch releases. To keep our options open, restore the
status quo ante; if we do end up deciding to change things, waiting
one more quarter won't hurt anything.
Rather than just doing a straight revert, I added a new test case
demonstrating the usage with LIMIT. That'll at least remind us of
the issue if we forget again.
Discussion: https://postgr.es/m/3603504.1652068977@sss.pgh.pa.us
Discussion: https://postgr.es/m/CADkLM=dzw0Pvdqp5yWKxMd+VmNkAMhG=4ku7GnCZxebWnzmz3Q@mail.gmail.com
This commit is contained in:
src
backend
utils
adt
test
regress
@ -5778,20 +5778,6 @@ generate_series_timestamp(PG_FUNCTION_ARGS)
|
||||
MemoryContext oldcontext;
|
||||
Interval interval_zero;
|
||||
|
||||
/* Reject infinities in start and stop values */
|
||||
if (TIMESTAMP_IS_NOBEGIN(start) ||
|
||||
TIMESTAMP_IS_NOEND(start))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("start value cannot be infinity")));
|
||||
if (TIMESTAMP_IS_NOBEGIN(finish) ||
|
||||
TIMESTAMP_IS_NOEND(finish))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("stop value cannot be infinity")));
|
||||
|
||||
/* Interval doesn't (currently) have infinity, so nothing to check */
|
||||
|
||||
/* create a function context for cross-call persistence */
|
||||
funcctx = SRF_FIRSTCALL_INIT();
|
||||
|
||||
@ -5872,20 +5858,6 @@ generate_series_timestamptz(PG_FUNCTION_ARGS)
|
||||
MemoryContext oldcontext;
|
||||
Interval interval_zero;
|
||||
|
||||
/* Reject infinities in start and stop values */
|
||||
if (TIMESTAMP_IS_NOBEGIN(start) ||
|
||||
TIMESTAMP_IS_NOEND(start))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("start value cannot be infinity")));
|
||||
if (TIMESTAMP_IS_NOBEGIN(finish) ||
|
||||
TIMESTAMP_IS_NOEND(finish))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("stop value cannot be infinity")));
|
||||
|
||||
/* Interval doesn't (currently) have infinity, so nothing to check */
|
||||
|
||||
/* create a function context for cross-call persistence */
|
||||
funcctx = SRF_FIRSTCALL_INIT();
|
||||
|
||||
|
Reference in New Issue
Block a user