heterodb / pg-strom

PG-Strom - Master development repository
http://heterodb.github.io/pg-strom/
Other
1.27k stars 163 forks source link

[bugfix] Fix the interval out of range bug in `pgfn_interval_um()` #776

Closed QingMa-gp closed 2 weeks ago

QingMa-gp commented 1 month ago

Reproduce steps:

postgres=# create table test(iv1 interval);
postgres=# insert into test select '2016-05-10 04:38:35.562587'::timestamp - '2016-05-11 04:38:35.562587'::timestamp;
postgres=# set enable_seqscan = 0;
SET
postgres=#  select -iv1 from test where iv1 < '0'::interval;
ERROR:  xpu_timelib.cu:2782  interval out of range
HINT:  device at GPU-0, function at pgfn_interval_um
postgres=# set enable_seqscan = 1;
SET
postgres=#  select -iv1 from test where iv1 < '0'::interval;
 ?column?
----------
 1 day
(1 row)
kaigai commented 2 weeks ago

Thanks for your patch! I could not remind why my previous implementation was different from the original interval_um() in PostgreSQL. Your fix well follows the original behavior.