forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6d73983
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 parent0353f48 commit6d73983
File tree
3 files changed
+159
-10
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+159
-10
lines changed| 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 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1079 | 1079 | | |
1080 | 1080 | | |
1081 | 1081 | | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
1082 | 1139 | | |
1083 | 1140 | | |
1084 | 1141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
689 | 689 | | |
690 | 690 | | |
691 | 691 | | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
692 | 709 | | |
693 | 710 | | |
694 | 711 | | |
| |||
0 commit comments
Comments
(0)