forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit747dd97
committed
Fix array slicing of int2vector and oidvector values.
The previous coding labeled expressions such as pg_index.indkey[1:3] asbeing of int2vector type; which is not right because the subscript boundsof such a result don't, in general, satisfy the restrictions of int2vector.To fix, implicitly promote the result of slicing int2vector to int2[],or oidvector to oid[]. This is similar to what we've done with domainsover arrays, which is a good analogy because these types are very muchlike restricted domains of the corresponding regular-array types.A side-effect is that we now also forbid array-element updates on suchcolumns, eg while "update pg_index set indkey[4] = 42" would have workedbefore if you were superuser (and corrupted your catalogs irretrievably,no doubt) it's now disallowed. This seems like a good thing since, again,some choices of subscripting would've led to results not satisfying therestrictions of int2vector. The case of an array-slice update wasrejected before, though with a different error message than you get now.We could make these cases work in future if we added a cast from int2[]to int2vector (with a cast function checking the subscript restrictions)but it seems unlikely that there's any value in that.Per report from Ronan Dunklau. Back-patch to all supported branchesbecause of the crash risks involved.1 parentec6a6a2 commit747dd97
2 files changed
+14
-0
lines changedLines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
270 | 270 |
| |
271 | 271 |
| |
272 | 272 |
| |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
273 | 285 |
| |
274 | 286 |
| |
275 | 287 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
426 | 426 |
| |
427 | 427 |
| |
428 | 428 |
| |
| 429 | + | |
429 | 430 |
| |
430 | 431 |
| |
431 | 432 |
| |
432 | 433 |
| |
433 | 434 |
| |
434 | 435 |
| |
435 | 436 |
| |
| 437 | + | |
436 | 438 |
| |
437 | 439 |
| |
438 | 440 |
| |
|
0 commit comments
Comments
(0)