forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1edb3b4
committed
Adjust populate_record_field() to handle errors softly
This adds a Node *escontext parameter to it and a bunch of functionsdownstream to it, replacing any ereport()s in that path by eithererrsave() or ereturn() as appropriate. This also adds code to thosefunctions where necessary to return early upon encountering a softerror.The changes here are mainly intended to suppress errors in thefunctions of jsonfuncs.c. Functions in any external modules, such asarrayfuncs.c, that those functions may in turn call are not changedhere based on the assumption that the various checks in jsonfuncs.cfunctions should ensure that only values that are structurally validget passed to the functions in those external modules. An exceptionis made for domain_check() to allow handling domain constraintviolation errors softly.For testing, this adds a function jsonb_populate_record_valid(),which returns true if jsonb_populate_record() would finish withoutcausing an error for the provided JSON object, false otherwise. Notethat jsonb_populate_record() internally calls populate_record(),which in turn uses populate_record_field().Extracted from a much larger patch to add SQL/JSON query functions.Author: Nikita Glukhov <n.gluhov@postgrespro.ru>Author: Teodor Sigaev <teodor@sigaev.ru>Author: Oleg Bartunov <obartunov@gmail.com>Author: Alexander Korotkov <aekorotkov@gmail.com>Author: Andrew Dunstan <andrew@dunslane.net>Author: Amit Langote <amitlangote09@gmail.com>Reviewers have included (in no particular order) Andres Freund,Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers,Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby,Álvaro Herrera, Jian He, Peter EisentrautDiscussion:https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ruDiscussion:https://postgr.es/m/20220616233130.rparivafipt6doj3@alap3.anarazel.deDiscussion:https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.orgDiscussion:https://postgr.es/m/CA+HiwqHROpf9e644D8BRqYvaAPmgBZVup-xKMDPk-nd4EpgzHw@mail.gmail.comDiscussion:https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com1 parentaaaf944 commit1edb3b4
File tree
7 files changed
+521
-87
lines changed- doc/src/sgml
- src
- backend/utils/adt
- include
- catalog
- utils
- test/regress
- expected
- sql
7 files changed
+521
-87
lines changedLines changed: 52 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16727 | 16727 |
| |
16728 | 16728 |
| |
16729 | 16729 |
| |
| 16730 | + | |
| 16731 | + | |
| 16732 | + | |
| 16733 | + | |
| 16734 | + | |
| 16735 | + | |
| 16736 | + | |
| 16737 | + | |
| 16738 | + | |
| 16739 | + | |
| 16740 | + | |
| 16741 | + | |
| 16742 | + | |
| 16743 | + | |
| 16744 | + | |
| 16745 | + | |
| 16746 | + | |
| 16747 | + | |
| 16748 | + | |
| 16749 | + | |
| 16750 | + | |
| 16751 | + | |
| 16752 | + | |
| 16753 | + | |
| 16754 | + | |
| 16755 | + | |
| 16756 | + | |
| 16757 | + | |
| 16758 | + | |
| 16759 | + | |
| 16760 | + | |
| 16761 | + | |
| 16762 | + | |
| 16763 | + | |
| 16764 | + | |
| 16765 | + | |
| 16766 | + | |
| 16767 | + | |
| 16768 | + | |
| 16769 | + | |
| 16770 | + | |
| 16771 | + | |
| 16772 | + | |
| 16773 | + | |
| 16774 | + | |
| 16775 | + | |
| 16776 | + | |
| 16777 | + | |
| 16778 | + | |
| 16779 | + | |
| 16780 | + | |
| 16781 | + | |
16730 | 16782 |
| |
16731 | 16783 |
| |
16732 | 16784 |
| |
|
Lines changed: 32 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 |
| |
44 | 47 |
| |
45 | 48 |
| |
| |||
342 | 345 |
| |
343 | 346 |
| |
344 | 347 |
| |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
345 | 374 |
| |
346 | 375 |
| |
347 | 376 |
| |
| |||
365 | 394 |
| |
366 | 395 |
| |
367 | 396 |
| |
368 |
| - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
369 | 400 |
| |
370 | 401 |
| |
371 | 402 |
| |
|
0 commit comments
Comments
(0)