You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix check_access_control_on_utilized_columns_only for CTE
Previously we weren't associating the with query with the columns used
from it in the main part of the query, so we wouldn't consider any
columns as used. When the usage within the cte or outside of it was
just an identifier, we would have the utilized column collected anyway
because the column collected in the main query kept the source table
information. However, if there was an expression in between, we would
lose that information, and we wouldn't check access control for the
column that was used in an expression in the cte.
Example:
For the following query
```
with cte as (select x as c1, z + 1 as c2 from t13) select c1, c2 from (select * from cte)
```
Previously we would only check access permissions on t13.x, but not
t13.z. With this change we will check column access on both 13.x and
t13.z.
LOG.debug(e, format("Error in analyzing utilized columns, falling back to access control on all columns: %s", analysis.getStatement()));
105
+
warningCollector.add(newPrestoWarning(UTILIZED_COLUMN_ANALYSIS_FAILED, "Error in analyzing utilized columns for access control, falling back to checking access on all columns."));
"with cte1 as (select x + 1 as c1, y as c2, z + 1 as c3 from t13), cte2 as (with cte1 AS (select y +1 as c1 from t13) select * from cte1) SELECT cte1.c1, cte2.c1 from cte1 join cte2 on cte1.c1=cte2.c1",
0 commit comments