Re: Add generate_series(numeric, numeric)
| От | Ali Akbar |
|---|---|
| Тема | Re: Add generate_series(numeric, numeric) |
| Дата | |
| Msg-id | CACQjQLr5MsPprcxVHRp1OzOU5PZ8Gv2WgYWQ9YyDJ+_cv-E=zg@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Add generate_series(numeric, numeric) (Michael Paquier <michael.paquier@gmail.com>) |
| Ответы |
Re: Add generate_series(numeric, numeric)
|
| Список | pgsql-hackers |
Hi
Oops, it seems that I have been too hasty here. With a fresh mind I looked at my own patch again and found two bugs:
--
Ali Akbar
- Incorrect calculation of each step's value, making stuff crash, it is necessary to switch to the context of the function to perform operations on a temporary variable first
- i think you can use the fctx->current variable without temporary variable (there's comment in the add_var function: Full version of add functionality on variable level (handling signs). result might point to one of the operands too without danger.). But you _must_ switch the context first because add_var will allocate new array for the data and freeing the old one.
- numeric can be NaN. We must reject it as first, finish and last parameter.
- numeric datatype is large, but there are limitations. According to doc, the limit is: up to 131072 digits before the decimal point; up to 16383 digits after the decimal point. How can we check if the next step overflows? As a comparison, in int.c, generate_series_step_int4 checks if its overflows, and stop the next call by setting step to 0. Should we do that?
~ will try to fix the patch later
Ali Akbar
В списке pgsql-hackers по дате отправления: