forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3d0f68d
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 parent80810ca commit3d0f68d
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 | |
---|---|---|---|
| |||
2447 | 2447 |
| |
2448 | 2448 |
| |
2449 | 2449 |
| |
2450 |
| - | |
2451 |
| - | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
2452 | 2456 |
| |
2453 | 2457 |
| |
2454 | 2458 |
| |
| |||
2465 | 2469 |
| |
2466 | 2470 |
| |
2467 | 2471 |
| |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
2468 | 2478 |
| |
2469 | 2479 |
| |
2470 | 2480 |
| |
| |||
2826 | 2836 |
| |
2827 | 2837 |
| |
2828 | 2838 |
| |
2829 |
| - | |
| 2839 | + | |
| 2840 | + | |
2830 | 2841 |
| |
2831 | 2842 |
| |
2832 | 2843 |
| |
2833 | 2844 |
| |
2834 |
| - | |
2835 | 2845 |
| |
| 2846 | + | |
| 2847 | + | |
2836 | 2848 |
| |
2837 | 2849 |
| |
2838 |
| - | |
2839 |
| - | |
2840 |
| - | |
2841 |
| - | |
2842 |
| - | |
2843 |
| - | |
| 2850 | + | |
| 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 | + | |
2844 | 2892 |
| |
2845 | 2893 |
| |
2846 | 2894 |
| |
| |||
3144 | 3192 |
| |
3145 | 3193 |
| |
3146 | 3194 |
| |
| 3195 | + | |
| 3196 | + | |
| 3197 | + | |
3147 | 3198 |
| |
3148 | 3199 |
| |
3149 | 3200 |
| |
| |||
3167 | 3218 |
| |
3168 | 3219 |
| |
3169 | 3220 |
| |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
3170 | 3224 |
| |
3171 | 3225 |
| |
3172 | 3226 |
| |
| |||
3211 | 3265 |
| |
3212 | 3266 |
| |
3213 | 3267 |
| |
| 3268 | + | |
| 3269 | + | |
| 3270 | + | |
3214 | 3271 |
| |
3215 | 3272 |
| |
3216 | 3273 |
| |
| |||
3910 | 3967 |
| |
3911 | 3968 |
| |
3912 | 3969 |
| |
| 3970 | + | |
| 3971 | + | |
| 3972 | + | |
3913 | 3973 |
| |
3914 | 3974 |
| |
3915 | 3975 |
| |
| |||
3933 | 3993 |
| |
3934 | 3994 |
| |
3935 | 3995 |
| |
| 3996 | + | |
| 3997 | + | |
| 3998 | + | |
3936 | 3999 |
| |
3937 | 4000 |
| |
3938 | 4001 |
| |
| |||
3977 | 4040 |
| |
3978 | 4041 |
| |
3979 | 4042 |
| |
| 4043 | + | |
| 4044 | + | |
| 4045 | + | |
3980 | 4046 |
| |
3981 | 4047 |
| |
3982 | 4048 |
| |
| |||
4092 | 4158 |
| |
4093 | 4159 |
| |
4094 | 4160 |
| |
| 4161 | + | |
| 4162 | + | |
| 4163 | + | |
4095 | 4164 |
| |
4096 | 4165 |
| |
4097 | 4166 |
| |
| |||
4115 | 4184 |
| |
4116 | 4185 |
| |
4117 | 4186 |
| |
| 4187 | + | |
| 4188 | + | |
| 4189 | + | |
4118 | 4190 |
| |
4119 | 4191 |
| |
4120 | 4192 |
| |
| |||
4159 | 4231 |
| |
4160 | 4232 |
| |
4161 | 4233 |
| |
| 4234 | + | |
| 4235 | + | |
| 4236 | + | |
4162 | 4237 |
| |
4163 | 4238 |
| |
4164 | 4239 |
| |
|
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)