- Notifications
You must be signed in to change notification settings - Fork5
Commite983c4d
committed
Rationalize the APIs of array element/slice access functions.
The four functions array_ref, array_set, array_get_slice, array_set_slicehave traditionally declared their array inputs and results as being of type"ArrayType *". This is a lie, and has been since Berkeley days, becausethey actually also support "fixed-length array" types such as "name" and"point"; not to mention that the inputs could be toasted. These valuesshould be declared Datum instead to avoid confusion. The current codingalready risks possible misoptimization by compilers, and it'll get worsewhen "expanded" array representations become a valid alternative.However, there's a fair amount of code using array_ref and array_set witharrays that *are* known to be ArrayType structures, and there might be moresuch places in third-party code. Rather than cluttering those call siteswith PointerGetDatum/DatumGetArrayTypeP cruft, what I did was to rename theexisting functions to array_get_element/array_set_element, fix theirsignatures, then reincarnate array_ref/array_set as backwards compatibilitywrappers.array_get_slice/array_set_slice have no such constituency in the core code,and probably not in third-party code either, so I just changed their APIs.1 parentcef3097 commite983c4d
File tree
5 files changed
+180
-142
lines changed- src
- backend
- executor
- rewrite
- utils/adt
- include/utils
- pl/plpgsql/src
5 files changed
+180
-142
lines changedLines changed: 51 additions & 61 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
252 | 252 |
| |
253 | 253 |
| |
254 | 254 |
| |
255 |
| - | |
256 |
| - | |
257 |
| - | |
258 |
| - | |
259 |
| - | |
260 |
| - | |
261 | 255 |
| |
262 | 256 |
| |
263 | 257 |
| |
| |||
267 | 261 |
| |
268 | 262 |
| |
269 | 263 |
| |
270 |
| - | |
271 |
| - | |
| 264 | + | |
272 | 265 |
| |
273 | 266 |
| |
274 | 267 |
| |
| |||
278 | 271 |
| |
279 | 272 |
| |
280 | 273 |
| |
281 |
| - | |
282 |
| - | |
283 |
| - | |
284 |
| - | |
285 |
| - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
286 | 278 |
| |
287 | 279 |
| |
288 | 280 |
| |
| |||
390 | 382 |
| |
391 | 383 |
| |
392 | 384 |
| |
393 |
| - | |
394 |
| - | |
395 |
| - | |
396 |
| - | |
397 |
| - | |
398 |
| - | |
399 |
| - | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
400 | 393 |
| |
401 | 394 |
| |
402 | 395 |
| |
403 |
| - | |
404 |
| - | |
405 |
| - | |
406 |
| - | |
407 |
| - | |
408 |
| - | |
409 |
| - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
410 | 403 |
| |
411 | 404 |
| |
412 | 405 |
| |
| |||
435 | 428 |
| |
436 | 429 |
| |
437 | 430 |
| |
438 |
| - | |
| 431 | + | |
439 | 432 |
| |
440 | 433 |
| |
441 | 434 |
| |
| |||
445 | 438 |
| |
446 | 439 |
| |
447 | 440 |
| |
448 |
| - | |
| 441 | + | |
449 | 442 |
| |
450 | 443 |
| |
451 | 444 |
| |
452 | 445 |
| |
453 |
| - | |
454 |
| - | |
455 |
| - | |
456 |
| - | |
457 |
| - | |
458 |
| - | |
459 |
| - | |
460 |
| - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
461 | 454 |
| |
462 |
| - | |
463 |
| - | |
464 |
| - | |
465 |
| - | |
466 |
| - | |
467 |
| - | |
468 |
| - | |
469 |
| - | |
470 |
| - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
471 | 463 |
| |
472 | 464 |
| |
473 | 465 |
| |
474 |
| - | |
475 |
| - | |
476 |
| - | |
477 |
| - | |
478 |
| - | |
479 |
| - | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
480 | 473 |
| |
481 |
| - | |
482 |
| - | |
483 |
| - | |
484 |
| - | |
485 |
| - | |
486 |
| - | |
487 |
| - | |
488 |
| - | |
489 |
| - | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
490 | 480 |
| |
491 | 481 |
| |
492 | 482 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
664 | 664 |
| |
665 | 665 |
| |
666 | 666 |
| |
667 |
| - | |
| 667 | + | |
668 | 668 |
| |
669 | 669 |
| |
670 | 670 |
| |
|
0 commit comments
Comments
(0)