- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit01c7a87
committed
Fix corner-case failures in has_foo_privilege() family of functions.
The variants of these functions that take numeric inputs (OIDs orcolumn numbers) are supposed to return NULL rather than failingon bad input; this rule reduces problems with snapshot skew whenqueries apply the functions to all rows of a catalog.has_column_privilege() had careless handling of the case where thetable OID didn't exist. You might get something like this:select has_column_privilege(9999,'nosuchcol','select');ERROR: column "nosuchcol" of relation "(null)" does not existor you might get a crash, depending on the platform's printf's responseto a null string pointer.In addition, while applying the column-number variant to a droppedcolumn returned NULL as desired, applying the column-name variantdid not:select has_column_privilege('mytable','........pg.dropped.2........','select');ERROR: column "........pg.dropped.2........" of relation "mytable" does not existIt seems better to make this case return NULL as well.Also, the OID-accepting variants of has_foreign_data_wrapper_privilege,has_server_privilege, and has_tablespace_privilege didn't follow theprinciple of returning NULL for nonexistent OIDs. Superusers got TRUE,everybody else got an error.Per investigation of Jaime Casanova's report of a new crash in HEAD.These behaviors have been like this for a long time, so back-patch toall supported branches.Patch by me; thanks to Stephen Frost for discussion and reviewDiscussion:https://postgr.es/m/CAJGNTeP=-6Gyqq5TN9OvYEydi7Fv1oGyYj650LGTnW44oAzYCg@mail.gmail.com1 parent4b2fb12 commit01c7a87
File tree
3 files changed
+159
-10
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+159
-10
lines changedLines changed: 85 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2450 | 2450 |
| |
2451 | 2451 |
| |
2452 | 2452 |
| |
2453 |
| - | |
2454 |
| - | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
2455 | 2459 |
| |
2456 | 2460 |
| |
2457 | 2461 |
| |
| |||
2468 | 2472 |
| |
2469 | 2473 |
| |
2470 | 2474 |
| |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
2471 | 2481 |
| |
2472 | 2482 |
| |
2473 | 2483 |
| |
| |||
2829 | 2839 |
| |
2830 | 2840 |
| |
2831 | 2841 |
| |
2832 |
| - | |
| 2842 | + | |
| 2843 | + | |
2833 | 2844 |
| |
2834 | 2845 |
| |
2835 | 2846 |
| |
2836 | 2847 |
| |
2837 |
| - | |
2838 | 2848 |
| |
| 2849 | + | |
| 2850 | + | |
2839 | 2851 |
| |
2840 | 2852 |
| |
2841 |
| - | |
2842 |
| - | |
2843 |
| - | |
2844 |
| - | |
2845 |
| - | |
2846 |
| - | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
2847 | 2895 |
| |
2848 | 2896 |
| |
2849 | 2897 |
| |
| |||
3147 | 3195 |
| |
3148 | 3196 |
| |
3149 | 3197 |
| |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
3150 | 3201 |
| |
3151 | 3202 |
| |
3152 | 3203 |
| |
| |||
3170 | 3221 |
| |
3171 | 3222 |
| |
3172 | 3223 |
| |
| 3224 | + | |
| 3225 | + | |
| 3226 | + | |
3173 | 3227 |
| |
3174 | 3228 |
| |
3175 | 3229 |
| |
| |||
3214 | 3268 |
| |
3215 | 3269 |
| |
3216 | 3270 |
| |
| 3271 | + | |
| 3272 | + | |
| 3273 | + | |
3217 | 3274 |
| |
3218 | 3275 |
| |
3219 | 3276 |
| |
| |||
3913 | 3970 |
| |
3914 | 3971 |
| |
3915 | 3972 |
| |
| 3973 | + | |
| 3974 | + | |
| 3975 | + | |
3916 | 3976 |
| |
3917 | 3977 |
| |
3918 | 3978 |
| |
| |||
3936 | 3996 |
| |
3937 | 3997 |
| |
3938 | 3998 |
| |
| 3999 | + | |
| 4000 | + | |
| 4001 | + | |
3939 | 4002 |
| |
3940 | 4003 |
| |
3941 | 4004 |
| |
| |||
3980 | 4043 |
| |
3981 | 4044 |
| |
3982 | 4045 |
| |
| 4046 | + | |
| 4047 | + | |
| 4048 | + | |
3983 | 4049 |
| |
3984 | 4050 |
| |
3985 | 4051 |
| |
| |||
4095 | 4161 |
| |
4096 | 4162 |
| |
4097 | 4163 |
| |
| 4164 | + | |
| 4165 | + | |
| 4166 | + | |
4098 | 4167 |
| |
4099 | 4168 |
| |
4100 | 4169 |
| |
| |||
4118 | 4187 |
| |
4119 | 4188 |
| |
4120 | 4189 |
| |
| 4190 | + | |
| 4191 | + | |
| 4192 | + | |
4121 | 4193 |
| |
4122 | 4194 |
| |
4123 | 4195 |
| |
| |||
4162 | 4234 |
| |
4163 | 4235 |
| |
4164 | 4236 |
| |
| 4237 | + | |
| 4238 | + | |
| 4239 | + | |
4165 | 4240 |
| |
4166 | 4241 |
| |
4167 | 4242 |
| |
|
Lines changed: 57 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1036 | 1036 |
| |
1037 | 1037 |
| |
1038 | 1038 |
| |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
1039 | 1096 |
| |
1040 | 1097 |
| |
1041 | 1098 |
| |
|
Lines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
657 | 657 |
| |
658 | 658 |
| |
659 | 659 |
| |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
660 | 677 |
| |
661 | 678 |
| |
662 | 679 |
| |
|
0 commit comments
Comments
(0)