Re: Added prosupport function for estimating numeric generate_series rows

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: 孤傲小二~阿沐 <tsinghualucky912(at)foxmail(dot)com>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, japinli <japinli(at)hotmail(dot)com>
Subject: Re: Added prosupport function for estimating numeric generate_series rows
Date: 2024-11-28 22:05:31
Message-ID: CAApHDvoXwFNrwFjVs4qW7_F050meRT7GrstXfhXPFudMGt_8xw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 29 Nov 2024 at 06:25, 孤傲小二~阿沐 <tsinghualucky912(at)foxmail(dot)com> wrote:
> Hello, thank you very much for your attention and guidance. I have modified and improved the problem you mentioned. The patch of version v2 is attached below.

I've only had a quick look at the patch.

* The following needs a DatumGetFloat8():

+ req->rows = numericvar_to_double_no_overflow(&q) + 1;

* It would also be good to see a comment explaining the following line:

+ if(nstep.sign != var_diff.sign)

Something like: /* When the sign of the step size and the series range
don't match, there are no rows in the series. */

* You should add one test for the generate_series(numeric, numeric).
You've only got tests for the 3 arg version.

Also a few minor things:

* Missing space after "if"

+ if(arg3)

* We always have an empty line after variable declarations, that's missing in:

+ NumericVar q;
+ init_var(&q);

* No need for the braces in:

+ if (NUMERIC_IS_SPECIAL(step))
+ {
+ goto cleanup;
+ }

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2024-11-28 22:40:21 Re: CI CompilerWarnings test fails on 15 in mingw_cross_warning
Previous Message Michail Nikolaev 2024-11-28 21:29:00 Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY