forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfe9b7b2
committed
Fix plpgsql to re-look-up composite type names at need.
Commit4b93f57 rearranged things in plpgsql to make it cope better withcomposite types changing underneath it intra-session. However, I failed toconsider the case of a composite type being dropped and recreated entirely.In my defense, the previous coding didn't consider that possibility at alleither --- but it would accidentally work so long as you didn't change thetype's field list, because the built-at-compile-time list of componentvariables would then still match the type's new definition. The newcoding, however, occasionally tries to re-look-up the type by OID, andthen fails to find the dropped type.To fix this, we need to save the TypeName struct, and then redo the typeOID lookup from that. Of course that's expensive, so we don't want to doit every time we need the type OID. This can be fixed in the same way that4b93f57 dealt with changes to composite types' definitions: keep an eyeon the type's typcache entry to see if its tupledesc has been invalidated.(Perhaps, at some point, this mechanism should be generalized so it canwork for non-composite types too; but for now, plpgsql only tries tocope with intra-session redefinitions of composites.)I'm slightly hesitant to back-patch this into v11, because it changesthe contents of struct PLpgSQL_type as well as the signature ofplpgsql_build_datatype(), so in principle it could break code that ispoking into the innards of plpgsql. However, the only popular extensionof that ilk is pldebugger, and it doesn't seem to be affected. Sincethis is a regression for people who were relying on the old behavior,it seems worth taking the small risk of causing compatibility issues.Per bug #15913 from Daniel Fiori. Back-patch to v11 where4b93f57came in.Discussion:https://postgr.es/m/15913-a7e112e16dedcffc@postgresql.org1 parentbb5ae8f commitfe9b7b2
File tree
7 files changed
+265
-37
lines changed- src
- backend/utils/cache
- pl/plpgsql/src
- expected
- sql
7 files changed
+265
-37
lines changedLines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2116 | 2116 |
| |
2117 | 2117 |
| |
2118 | 2118 |
| |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
2119 | 2129 |
| |
2120 | 2130 |
| |
2121 | 2131 |
| |
|
Lines changed: 29 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
447 | 447 |
| |
448 | 448 |
| |
449 | 449 |
| |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
450 | 479 |
| |
451 | 480 |
| |
452 | 481 |
| |
|
0 commit comments
Comments
(0)