forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitdcbf594
committed
Improve qual pushdown for RLS and SB views
The original security barrier view implementation, on which RLS isbuilt, prevented all non-leakproof functions from being pushed down tobelow the view, even when the function was not receiving any data fromthe view. This optimization improves on that situation by, instead ofchecking strictly for non-leakproof functions, it checks for Vars beingpassed to non-leakproof functions and allows functions which do notaccept arguments or whose arguments are not from the current query level(eg: constants can be particularly useful) to be pushed down.As discussed, this does mean that a function which is pushed down mightgain some idea that there are rows meeting a certain criteria based onthe number of times the function is called, but this isn't aparticularly new issue and the documentation in rules.sgml alreadyaddressed similar covert-channel risks. That documentation is updatedto reflect that non-leakproof functions may be pushed down now, ifthey meet the above-described criteria.Author: Dean Rasheed, with a bit of rework to make things clearer,along with comment and documentation updates from me.1 parent06ca28d commitdcbf594
File tree
10 files changed
+320
-39
lines changed- doc/src/sgml
- src
- backend/optimizer
- path
- util
- include/optimizer
- test
- modules/test_rls_hooks/expected
- regress
- expected
- sql
10 files changed
+320
-39
lines changedLines changed: 7 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2136 | 2136 |
| |
2137 | 2137 |
| |
2138 | 2138 |
| |
2139 |
| - | |
| 2139 | + | |
2140 | 2140 |
| |
2141 | 2141 |
| |
2142 | 2142 |
| |
| |||
2157 | 2157 |
| |
2158 | 2158 |
| |
2159 | 2159 |
| |
2160 |
| - | |
2161 |
| - | |
2162 |
| - | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
2163 | 2166 |
| |
2164 | 2167 |
| |
2165 | 2168 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1982 | 1982 |
| |
1983 | 1983 |
| |
1984 | 1984 |
| |
1985 |
| - | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
1986 | 1988 |
| |
1987 | 1989 |
| |
1988 | 1990 |
| |
| |||
2009 | 2011 |
| |
2010 | 2012 |
| |
2011 | 2013 |
| |
2012 |
| - | |
| 2014 | + | |
2013 | 2015 |
| |
2014 | 2016 |
| |
2015 | 2017 |
| |
|
Lines changed: 71 additions & 25 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
97 | 97 |
| |
98 | 98 |
| |
99 | 99 |
| |
100 |
| - | |
| 100 | + | |
101 | 101 |
| |
102 | 102 |
| |
103 | 103 |
| |
| |||
1318 | 1318 |
| |
1319 | 1319 |
| |
1320 | 1320 |
| |
1321 |
| - | |
| 1321 | + | |
1322 | 1322 |
| |
1323 | 1323 |
| |
1324 | 1324 |
| |
1325 |
| - | |
1326 |
| - | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
1327 | 1329 |
| |
1328 |
| - | |
1329 |
| - | |
1330 |
| - | |
1331 |
| - | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
1332 | 1336 |
| |
1333 | 1337 |
| |
1334 |
| - | |
| 1338 | + | |
1335 | 1339 |
| |
1336 |
| - | |
| 1340 | + | |
1337 | 1341 |
| |
1338 | 1342 |
| |
1339 | 1343 |
| |
1340 |
| - | |
| 1344 | + | |
1341 | 1345 |
| |
1342 | 1346 |
| |
1343 | 1347 |
| |
| |||
1369 | 1373 |
| |
1370 | 1374 |
| |
1371 | 1375 |
| |
1372 |
| - | |
| 1376 | + | |
| 1377 | + | |
1373 | 1378 |
| |
1374 | 1379 |
| |
1375 | 1380 |
| |
| |||
1381 | 1386 |
| |
1382 | 1387 |
| |
1383 | 1388 |
| |
1384 |
| - | |
| 1389 | + | |
| 1390 | + | |
1385 | 1391 |
| |
1386 | 1392 |
| |
1387 | 1393 |
| |
| |||
1391 | 1397 |
| |
1392 | 1398 |
| |
1393 | 1399 |
| |
1394 |
| - | |
| 1400 | + | |
| 1401 | + | |
1395 | 1402 |
| |
1396 | 1403 |
| |
1397 | 1404 |
| |
| |||
1401 | 1408 |
| |
1402 | 1409 |
| |
1403 | 1410 |
| |
| 1411 | + | |
1404 | 1412 |
| |
1405 | 1413 |
| |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
1406 | 1418 |
| |
1407 | 1419 |
| |
1408 |
| - | |
1409 |
| - | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
1410 | 1431 |
| |
1411 |
| - | |
1412 |
| - | |
| 1432 | + | |
| 1433 | + | |
1413 | 1434 |
| |
1414 | 1435 |
| |
1415 | 1436 |
| |
| |||
1419 | 1440 |
| |
1420 | 1441 |
| |
1421 | 1442 |
| |
| 1443 | + | |
1422 | 1444 |
| |
1423 | 1445 |
| |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
1424 | 1450 |
| |
1425 | 1451 |
| |
1426 |
| - | |
1427 |
| - | |
1428 |
| - | |
1429 |
| - | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
1430 | 1466 |
| |
1431 | 1467 |
| |
1432 | 1468 |
| |
| |||
1435 | 1471 |
| |
1436 | 1472 |
| |
1437 | 1473 |
| |
| 1474 | + | |
| 1475 | + | |
1438 | 1476 |
| |
1439 |
| - | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
1440 | 1484 |
| |
1441 | 1485 |
| |
1442 | 1486 |
| |
1443 |
| - | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
1444 | 1490 |
| |
1445 | 1491 |
| |
1446 | 1492 |
| |
| |||
1455 | 1501 |
| |
1456 | 1502 |
| |
1457 | 1503 |
| |
1458 |
| - | |
| 1504 | + | |
1459 | 1505 |
| |
1460 | 1506 |
| |
1461 | 1507 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
63 | 63 |
| |
64 | 64 |
| |
65 | 65 |
| |
66 |
| - | |
| 66 | + | |
67 | 67 |
| |
68 | 68 |
| |
69 | 69 |
| |
|
Lines changed: 5 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
85 | 85 |
| |
86 | 86 |
| |
87 | 87 |
| |
88 |
| - | |
89 |
| - | |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
95 | 93 |
| |
96 | 94 |
| |
97 | 95 |
| |
|
Lines changed: 106 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1913 | 1913 |
| |
1914 | 1914 |
| |
1915 | 1915 |
| |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
1916 | 2022 |
| |
1917 | 2023 |
| |
1918 | 2024 |
| |
|
0 commit comments
Comments
(0)