git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 2fbd786) | patch
tablefunc: Reject negative number of tuples passed to normal_rand()
2020年11月25日 14:30:18 +0000 (15:30 +0100)
2020年11月25日 14:30:18 +0000 (15:30 +0100)
commit f73999262ed6c40d9a7c3d7cccec7143d4d15287
tablefunc: Reject negative number of tuples passed to normal_rand()

The function converted the first argument i.e. the number of tuples to
return into an unsigned integer which turns out to be huge number when
a negative value is passed. This causes the function to take much
longer time to execute. Instead, reject a negative value.

(If someone really wants to generate many more result rows, they
should consider adding a bigint or numeric variant.)

While at it, improve SQL test to test the number of tuples returned by
this function.

Author: Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>
Discussion: https://www.postgresql.org/message-id/CAG-ACPW3PUUmSnM6cLa9Rw4BEC5cEMKjX8Gogc8gvQcT3cYA1A@mail.gmail.com
contrib/tablefunc/expected/tablefunc.out diff | blob | blame | history
contrib/tablefunc/sql/tablefunc.sql diff | blob | blame | history
contrib/tablefunc/tablefunc.c diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /