forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb6f5689
committed
Fix conversion of JSON strings to JSON output columns in json_to_record().
json_to_record(), when an output column is declared as type json or jsonb,should emit the corresponding field of the input JSON object. But it gotthis slightly wrong when the field is just a string literal: it failed toescape the contents of the string. That typically resulted in syntaxerrors if the string contained any double quotes or backslashes.jsonb_to_record() handles such cases correctly, but I added correspondingtest cases for it too, to prevent future backsliding.Improve the documentation, as it provided only a very hand-wavydescription of the conversion rules used by these functions.Per bug report from Robert Vollmert. Back-patch to v10 where theerror was introduced (by commitcf35346).Note that PG 9.4 - 9.6 also get this case wrong, but differently so:they feed the de-escaped contents of the string literal to json[b]_in.That behavior is less obviously wrong, so possibly it's being depended onin the field, so I won't risk trying to make the older branches behavelike the newer ones.Discussion:https://postgr.es/m/D6921B37-BD8E-4664-8D5F-DB3525765DCD@vllmrt.net1 parent52ad5fc commitb6f5689
6 files changed
+167
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11864 | 11864 | | |
11865 | 11865 | | |
11866 | 11866 | | |
11867 | | - | |
11868 | | - | |
11869 | | - | |
11870 | | - | |
11871 | | - | |
11872 | | - | |
11873 | | - | |
11874 | | - | |
11875 | | - | |
11876 | | - | |
11877 | | - | |
11878 | | - | |
11879 | | - | |
11880 | | - | |
| 11867 | + | |
| 11868 | + | |
| 11869 | + | |
| 11870 | + | |
| 11871 | + | |
| 11872 | + | |
| 11873 | + | |
| 11874 | + | |
| 11875 | + | |
| 11876 | + | |
| 11877 | + | |
| 11878 | + | |
| 11879 | + | |
| 11880 | + | |
| 11881 | + | |
| 11882 | + | |
| 11883 | + | |
| 11884 | + | |
| 11885 | + | |
| 11886 | + | |
| 11887 | + | |
| 11888 | + | |
| 11889 | + | |
| 11890 | + | |
| 11891 | + | |
| 11892 | + | |
| 11893 | + | |
| 11894 | + | |
| 11895 | + | |
| 11896 | + | |
| 11897 | + | |
| 11898 | + | |
| 11899 | + | |
| 11900 | + | |
| 11901 | + | |
| 11902 | + | |
| 11903 | + | |
| 11904 | + | |
| 11905 | + | |
| 11906 | + | |
| 11907 | + | |
| 11908 | + | |
| 11909 | + | |
| 11910 | + | |
| 11911 | + | |
| 11912 | + | |
| 11913 | + | |
| 11914 | + | |
| 11915 | + | |
| 11916 | + | |
| 11917 | + | |
| 11918 | + | |
| 11919 | + | |
| 11920 | + | |
| 11921 | + | |
11881 | 11922 | | |
11882 | | - | |
11883 | | - | |
11884 | | - | |
11885 | | - | |
11886 | | - | |
11887 | | - | |
11888 | | - | |
11889 | | - | |
| 11923 | + | |
| 11924 | + | |
| 11925 | + | |
| 11926 | + | |
| 11927 | + | |
| 11928 | + | |
| 11929 | + | |
| 11930 | + | |
| 11931 | + | |
| 11932 | + | |
11890 | 11933 | | |
11891 | 11934 | | |
11892 | 11935 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2762 | 2762 | | |
2763 | 2763 | | |
2764 | 2764 | | |
2765 | | - | |
2766 | | - | |
2767 | | - | |
2768 | | - | |
2769 | | - | |
2770 | | - | |
2771 | | - | |
2772 | | - | |
2773 | | - | |
2774 | | - | |
2775 | | - | |
2776 | | - | |
2777 | | - | |
2778 | | - | |
2779 | | - | |
2780 | | - | |
2781 | | - | |
2782 | | - | |
2783 | | - | |
2784 | | - | |
| 2765 | + | |
2785 | 2766 | | |
2786 | 2767 | | |
2787 | 2768 | | |
2788 | 2769 | | |
2789 | 2770 | | |
2790 | 2771 | | |
2791 | 2772 | | |
2792 | | - | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
2793 | 2788 | | |
2794 | 2789 | | |
2795 | 2790 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2200 | 2200 | | |
2201 | 2201 | | |
2202 | 2202 | | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
2203 | 2239 | | |
2204 | 2240 | | |
2205 | 2241 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2578 | 2578 | | |
2579 | 2579 | | |
2580 | 2580 | | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
| 2600 | + | |
| 2601 | + | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
| 2608 | + | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
| 2613 | + | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
2581 | 2617 | | |
2582 | 2618 | | |
2583 | 2619 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
712 | 712 | | |
713 | 713 | | |
714 | 714 | | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
715 | 722 | | |
716 | 723 | | |
717 | 724 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
681 | 681 | | |
682 | 682 | | |
683 | 683 | | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
684 | 691 | | |
685 | 692 | | |
686 | 693 | | |
| |||
0 commit comments
Comments
(0)