forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitca74e3e
committed
Use checkAsUser for selectivity estimator checks, if it's set.
In examine_variable() and examine_simple_variable(), when checking theuser's table and column privileges to determine whether to grantaccess to the pg_statistic data, use checkAsUser for the privilegechecks, if it's set. This will be the case if we're accessing thetable via a view, to indicate that we should perform privilege checksas the view owner rather than the current user.This change makes this planner check consistent with the check in theexecutor, so the planner will be able to make use of statistics if thetable is accessible via the view. This fixes a performance regressionintroduced by commite2d4ef8, which affects queries againstnon-security barrier views in the case where the user doesn't haveprivileges on the underlying table, but the view owner does.Note that it continues to provide the same safeguards controllingaccess to pg_statistic for direct table access (in which casecheckAsUser won't be set) and for security barrier views, because ofthe nearby checks on rte->security_barrier and rte->securityQuals.Back-patch to all supported branches becausee2d4ef8 was.Dean Rasheed, reviewed by Jonathan Katz and Stephen Frost.1 parent9408028 commitca74e3e
File tree
3 files changed
+101
-15
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+101
-15
lines changedLines changed: 16 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4778 | 4778 |
| |
4779 | 4779 |
| |
4780 | 4780 |
| |
| 4781 | + | |
4781 | 4782 |
| |
4782 | 4783 |
| |
4783 | 4784 |
| |
4784 | 4785 |
| |
| 4786 | + | |
| 4787 | + | |
| 4788 | + | |
| 4789 | + | |
| 4790 | + | |
| 4791 | + | |
4785 | 4792 |
| |
4786 | 4793 |
| |
4787 | 4794 |
| |
| |||
4793 | 4800 |
| |
4794 | 4801 |
| |
4795 | 4802 |
| |
4796 |
| - | |
| 4803 | + | |
4797 | 4804 |
| |
4798 | 4805 |
| |
4799 | 4806 |
| |
| |||
4856 | 4863 |
| |
4857 | 4864 |
| |
4858 | 4865 |
| |
| 4866 | + | |
| 4867 | + | |
4859 | 4868 |
| |
4860 | 4869 |
| |
4861 | 4870 |
| |
4862 |
| - | |
| 4871 | + | |
| 4872 | + | |
4863 | 4873 |
| |
| 4874 | + | |
| 4875 | + | |
4864 | 4876 |
| |
4865 | 4877 |
| |
4866 |
| - | |
| 4878 | + | |
4867 | 4879 |
| |
4868 |
| - | |
| 4880 | + | |
4869 | 4881 |
| |
4870 | 4882 |
| |
4871 | 4883 |
| |
|
Lines changed: 64 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
185 | 185 |
| |
186 | 186 |
| |
187 | 187 |
| |
188 |
| - | |
| 188 | + | |
189 | 189 |
| |
190 | 190 |
| |
191 | 191 |
| |
| |||
197 | 197 |
| |
198 | 198 |
| |
199 | 199 |
| |
200 |
| - | |
| 200 | + | |
201 | 201 |
| |
202 | 202 |
| |
| 203 | + | |
| 204 | + | |
203 | 205 |
| |
| 206 | + | |
204 | 207 |
| |
205 | 208 |
| |
206 | 209 |
| |
| |||
225 | 228 |
| |
226 | 229 |
| |
227 | 230 |
| |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
228 | 245 |
| |
229 | 246 |
| |
230 | 247 |
| |
| |||
235 | 252 |
| |
236 | 253 |
| |
237 | 254 |
| |
238 |
| - | |
| 255 | + | |
| 256 | + | |
239 | 257 |
| |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
240 | 269 |
| |
241 | 270 |
| |
242 |
| - | |
243 |
| - | |
| 271 | + | |
| 272 | + | |
244 | 273 |
| |
245 | 274 |
| |
246 |
| - | |
| 275 | + | |
247 | 276 |
| |
248 | 277 |
| |
249 | 278 |
| |
250 | 279 |
| |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
251 | 308 |
| |
252 | 309 |
| |
253 | 310 |
| |
254 | 311 |
| |
255 |
| - | |
| 312 | + | |
256 | 313 |
| |
257 | 314 |
| |
258 | 315 |
| |
|
Lines changed: 21 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
129 | 129 |
| |
130 | 130 |
| |
131 | 131 |
| |
132 |
| - | |
| 132 | + | |
133 | 133 |
| |
134 | 134 |
| |
135 | 135 |
| |
| |||
144 | 144 |
| |
145 | 145 |
| |
146 | 146 |
| |
147 |
| - | |
| 147 | + | |
148 | 148 |
| |
149 | 149 |
| |
| 150 | + | |
| 151 | + | |
150 | 152 |
| |
| 153 | + | |
151 | 154 |
| |
152 | 155 |
| |
153 | 156 |
| |
| |||
156 | 159 |
| |
157 | 160 |
| |
158 | 161 |
| |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
159 | 166 |
| |
160 | 167 |
| |
161 | 168 |
| |
| |||
168 | 175 |
| |
169 | 176 |
| |
170 | 177 |
| |
171 |
| - | |
| 178 | + | |
| 179 | + | |
172 | 180 |
| |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
173 | 190 |
| |
174 | 191 |
| |
175 | 192 |
| |
176 | 193 |
| |
177 | 194 |
| |
178 | 195 |
| |
179 |
| - | |
| 196 | + | |
180 | 197 |
| |
181 | 198 |
| |
182 | 199 |
| |
|
0 commit comments
Comments
(0)