Skip to content

Commit

Permalink
Enhance view owner validation
Browse files Browse the repository at this point in the history
  • Loading branch information
sopel39 committed Apr 19, 2021
1 parent 60681db commit f4dcf75
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,9 @@ private List<ConnectorViewDefinition.ViewColumn> translateMaterializedViewColumn

private Scope createScopeForView(Table table, QualifiedObjectName name, Optional<Scope> scope, ConnectorViewDefinition view)
{
if (!view.isRunAsInvoker() && view.getOwner().isEmpty()) {
throw semanticException(INVALID_VIEW, table, "Owner must be present in view '%s' with SECURITY DEFINER mode", name);
}
return createScopeForView(table, name, scope, view.getOriginalSql(), view.getCatalog(), view.getSchema(), view.getOwner(), view.getColumns());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3242,7 +3242,7 @@ public void setup()
ImmutableList.of(new ViewColumn("a", BIGINT.getTypeId())),
Optional.empty(),
Optional.empty(),
false);
true);
inSetupTransaction(session -> metadata.createView(
session,
tableViewAndMaterializedView,
Expand Down

0 comments on commit f4dcf75

Please sign in to comment.