Re: Add generate_series(numeric, numeric)

From: Ali Akbar <the(dot)apaan(at)gmail(dot)com>
To: Marti Raudsepp <marti(at)juffo(dot)org>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Платон Малюгин <malugin(dot)p(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add generate_series(numeric, numeric)
Date: 2014-10-06 23:38:45
Message-ID: CACQjQLpHYymSnF4prwaJN3Wa9ppfEtDTqR0BNVuQ0FjeUgTVNw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2014-10-06 22:51 GMT+07:00 Marti Raudsepp <marti(at)juffo(dot)org>:

> That's fine I think, it's just for tracking who made the changes in
> the CommitFest app. What actually matters is what you write in the
> "Author" field, which could contain all 3 names separated by commas.
>

Ok. Added to commitfest:
https://commitfest.postgresql.org/action/patch_view?id=1591

> > the one that tests values just before numeric overflow
>
> Actually I don't know if that's too useful. I think you should add a
> test case that causes an error to be thrown.
>

Actually i added the test case because in the code, when adding step into
current for the last value, i expected it to overflow:

/* increment current in preparation for next iteration */
add_var(&fctx->current, &fctx->step, &fctx->current);

where in the last calculation, current is 9 * 10^131071. Plus 10^131071, it
will be 10^131072, which i expected to overflow numeric type (in the doc,
numeric's range is "up to 131072 digits before the decimal point").

In attached patch, i narrowed the test case to produce smaller result.

Also, I noticed that there are a few trailing spaces in the patch that
> should be removed:
>
> +generate_series_numeric(PG_FUNCTION_ARGS)
> ...
> + if (NUMERIC_IS_NAN(start_num) ||
> NUMERIC_IS_NAN(finish_num))
> ...
> + if (PG_NARGS() == 3)
> ...
> + if (NUMERIC_IS_NAN(step_num))
>

Ah, didn't see it. Thanks. Fixed in this patch.

Regards,
--
Ali Akbar

Attachment Content-Type Size
20141007_generate_series_numeric.patch text/x-diff 11.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2014-10-06 23:41:11 Re: Add regression tests for autocommit-off mode for psql and fix some omissions
Previous Message Jim Nasby 2014-10-06 23:19:34 Re: Proposal for better support of time-varying timezone abbreviations