On Sat, Mar 4, 2023 at 11:23 AM Keisuke Kuroda <
kuroda.keisuke@nttcom.co.jp> wrote:
>
> Good catch.
> Of the reserved words that are special values of type Date/Time,
> 'now', 'today', 'tomorrow', 'yesterday', and 'allballs',
> I get an error even before applying the patch.
Thanks for pointing this out. After taking a look
at the code, 'now', 'today', 'tomorrow',
'yesterday', and 'allballs' all set the
appropriate tmask field which is what causes them
to error.
case DTK_NOW:
tmask = (DTK_DATE_M | DTK_TIME_M | DTK_M(TZ));
case DTK_YESTERDAY:
tmask = DTK_DATE_M;
case DTK_TODAY:
tmask = DTK_DATE_M;
case DTK_TOMORROW:
tmask = DTK_DATE_M;
case DTK_ZULU:
tmask = (DTK_TIME_M | DTK_M(TZ));
while 'epoch', 'infinity', and '-infinity' do not
set tmask (note the default below handles all of
these fields)
default:
*dtype = val;
So I think a better fix here would be to also set
tmask for those three reserved keywords.
> One thing I noticed is that the following SQL
> returns normal results even after applying the patch.
>
> postgres=# select timestamp 'epoch 01:01:01';
> timestamp
> ---------------------
> 1970-01-01 00:00:00
> (1 row)
>
> When 'epoch','infinity','-infinity' and time are specified together,
> the time specified in the SQL is not included in result.
> I think it might be better to assume that this pattern is also an error.
> What do you think?
I agree this pattern should also be an error. I
think that the tmask approach will cause an error
for this pattern as well.
Thanks,
Joe Koshakow