forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf739992
committed
tablefunc: Reject negative number of tuples passed to normal_rand()
The function converted the first argument i.e. the number of tuples toreturn into an unsigned integer which turns out to be huge number whena negative value is passed. This causes the function to take muchlonger time to execute. Instead, reject a negative value.(If someone really wants to generate many more result rows, theyshould consider adding a bigint or numeric variant.)While at it, improve SQL test to test the number of tuples returned bythis function.Author: Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>Discussion:https://www.postgresql.org/message-id/CAG-ACPW3PUUmSnM6cLa9Rw4BEC5cEMKjX8Gogc8gvQcT3cYA1A@mail.gmail.com1 parent2fbd786 commitf739992
File tree
3 files changed
+18
-6
lines changed- contrib/tablefunc
- expected
- sql
3 files changed
+18
-6
lines changedLines changed: 7 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 |
| - | |
7 |
| - | |
8 |
| - | |
9 |
| - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
10 | 10 |
| |
11 | 11 |
| |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 |
| |
13 | 16 |
| |
14 | 17 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4 | 4 |
| |
5 | 5 |
| |
6 | 6 |
| |
7 |
| - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
8 | 10 |
| |
9 | 11 |
| |
10 | 12 |
| |
|
Lines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
184 | 184 |
| |
185 | 185 |
| |
186 | 186 |
| |
| 187 | + | |
| 188 | + | |
187 | 189 |
| |
188 | 190 |
| |
189 | 191 |
| |
| |||
193 | 195 |
| |
194 | 196 |
| |
195 | 197 |
| |
196 |
| - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
197 | 204 |
| |
198 | 205 |
| |
199 | 206 |
| |
|
0 commit comments
Comments
(0)