forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit419cc8a
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 parente9cff30 commit419cc8a
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 | |
---|---|---|---|
| |||
2448 | 2448 |
| |
2449 | 2449 |
| |
2450 | 2450 |
| |
2451 |
| - | |
2452 |
| - | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
2453 | 2457 |
| |
2454 | 2458 |
| |
2455 | 2459 |
| |
| |||
2466 | 2470 |
| |
2467 | 2471 |
| |
2468 | 2472 |
| |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
2469 | 2479 |
| |
2470 | 2480 |
| |
2471 | 2481 |
| |
| |||
2827 | 2837 |
| |
2828 | 2838 |
| |
2829 | 2839 |
| |
2830 |
| - | |
| 2840 | + | |
| 2841 | + | |
2831 | 2842 |
| |
2832 | 2843 |
| |
2833 | 2844 |
| |
2834 | 2845 |
| |
2835 |
| - | |
2836 | 2846 |
| |
| 2847 | + | |
| 2848 | + | |
2837 | 2849 |
| |
2838 | 2850 |
| |
2839 |
| - | |
2840 |
| - | |
2841 |
| - | |
2842 |
| - | |
2843 |
| - | |
2844 |
| - | |
| 2851 | + | |
| 2852 | + | |
| 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 | + | |
2845 | 2893 |
| |
2846 | 2894 |
| |
2847 | 2895 |
| |
| |||
3145 | 3193 |
| |
3146 | 3194 |
| |
3147 | 3195 |
| |
| 3196 | + | |
| 3197 | + | |
| 3198 | + | |
3148 | 3199 |
| |
3149 | 3200 |
| |
3150 | 3201 |
| |
| |||
3168 | 3219 |
| |
3169 | 3220 |
| |
3170 | 3221 |
| |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
3171 | 3225 |
| |
3172 | 3226 |
| |
3173 | 3227 |
| |
| |||
3212 | 3266 |
| |
3213 | 3267 |
| |
3214 | 3268 |
| |
| 3269 | + | |
| 3270 | + | |
| 3271 | + | |
3215 | 3272 |
| |
3216 | 3273 |
| |
3217 | 3274 |
| |
| |||
3911 | 3968 |
| |
3912 | 3969 |
| |
3913 | 3970 |
| |
| 3971 | + | |
| 3972 | + | |
| 3973 | + | |
3914 | 3974 |
| |
3915 | 3975 |
| |
3916 | 3976 |
| |
| |||
3934 | 3994 |
| |
3935 | 3995 |
| |
3936 | 3996 |
| |
| 3997 | + | |
| 3998 | + | |
| 3999 | + | |
3937 | 4000 |
| |
3938 | 4001 |
| |
3939 | 4002 |
| |
| |||
3978 | 4041 |
| |
3979 | 4042 |
| |
3980 | 4043 |
| |
| 4044 | + | |
| 4045 | + | |
| 4046 | + | |
3981 | 4047 |
| |
3982 | 4048 |
| |
3983 | 4049 |
| |
| |||
4093 | 4159 |
| |
4094 | 4160 |
| |
4095 | 4161 |
| |
| 4162 | + | |
| 4163 | + | |
| 4164 | + | |
4096 | 4165 |
| |
4097 | 4166 |
| |
4098 | 4167 |
| |
| |||
4116 | 4185 |
| |
4117 | 4186 |
| |
4118 | 4187 |
| |
| 4188 | + | |
| 4189 | + | |
| 4190 | + | |
4119 | 4191 |
| |
4120 | 4192 |
| |
4121 | 4193 |
| |
| |||
4160 | 4232 |
| |
4161 | 4233 |
| |
4162 | 4234 |
| |
| 4235 | + | |
| 4236 | + | |
| 4237 | + | |
4163 | 4238 |
| |
4164 | 4239 |
| |
4165 | 4240 |
| |
|
Lines changed: 57 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1132 | 1132 |
| |
1133 | 1133 |
| |
1134 | 1134 |
| |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
1135 | 1192 |
| |
1136 | 1193 |
| |
1137 | 1194 |
| |
|
Lines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
715 | 715 |
| |
716 | 716 |
| |
717 | 717 |
| |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
718 | 735 |
| |
719 | 736 |
| |
720 | 737 |
| |
|
0 commit comments
Comments
(0)