Re: BUG #16863: Assert failed in set_plain_rel_size() on processing ~* with a long prefix
Alexander Law <exclusion@gmail.com>
From: Alexander Lakhin <exclusion@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2021-02-12T21:00:00Z
Lists: pgsql-bugs
Hello Tom,
12.02.2021 23:37, Tom Lane wrote:
> Alexander Lakhin <exclusion@gmail.com> writes:
>> I've found a division that produces NaN:
>> sel /= pow(FIXED_CHAR_SEL, fixed_prefix_len);
> Hmm. I'm not getting a NaN AFAICT, but I am getting pretty darn weird
> estimates. I agree this needs some kind of clamp.
>
> regression=# create table test (t text);
> CREATE TABLE
> regression=# explain SELECT * FROM test WHERE t ~* ('^' || repeat('-', 500));
> ...
> Seq Scan on test (cost=0.00..27.00 rows=10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104 width=32)
The same number I've seen on the master branch. But on REL_13_STABLE I
get a NaN and then the assertion failure. (I've chosen the version 13.2
in the bug report, but it's really delayed somewhere.)
Though that division produced a NaN for me on both branches.
Best regards,
Alexander
Commits
-
Avoid divide-by-zero in regex_selectivity() with long fixed prefix.
- f4d781dae6b6 9.6.22 landed
- ae4867ec7496 14.0 landed
- a28df6fa3041 11.12 landed
- 3a02d68a96ed 13.3 landed
- 374f1cefe56c 10.17 landed
- 0347470b31c1 12.7 landed
-
Prevent overly large and NaN row estimates in relations
- a90c950fc7fd 14.0 cited