Re: Add generate_series(numeric, numeric)
От | Andrew Gierth |
---|---|
Тема | Re: Add generate_series(numeric, numeric) |
Дата | |
Msg-id | 87mw6ppraf.fsf@news-spur.riddles.org.uk обсуждение исходный текст |
Ответ на | Re: Add generate_series(numeric, numeric) (Fujii Masao <masao.fujii@gmail.com>) |
Ответы |
Re: Add generate_series(numeric, numeric)
Re: Add generate_series(numeric, numeric) |
Список | pgsql-hackers |
>>>>> "Fujii" == Fujii Masao <masao.fujii@gmail.com> writes: Fujii> Pushed. Bug found: regression=# select count(*) from generate_series(1::numeric,10) v, generate_series(1,v) w; count ------- 99990 (1 row) regression=# select count(*) from generate_series(1::numeric,10) v, generate_series(1,v+0) w; count ------- 55 (1 row) The error is in the use of PG_GETARG_NUMERIC and init_var_from_num when setting up the multi-call state; init_var_from_num points at the original num's digits rather than copying them, but start_num and stop_num have just been (potentially) detoasted in the per-call context, in which case the storage will have been freed by the next call. Obviously this could also be fixed by not detoasting the input until after switching to the multi-call context, but it looks to me like that would be unnecessarily complex. Suggested patch attached. (Is it also worth putting an explicit warning about this kind of thing in the SRF docs?) -- Andrew (irc:RhodiumToad)
Вложения
В списке pgsql-hackers по дате отправления: