Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve insert row filter violation message grammar #15097

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ private RelationPlan getInsertPlan(
plan = planner.addRowFilters(
table,
plan,
failIfPredicateIsNotMet(metadata, session, PERMISSION_DENIED, AccessDeniedException.PREFIX + "Cannot insert row that does not match to a row filter"),
failIfPredicateIsNotMet(metadata, session, PERMISSION_DENIED, AccessDeniedException.PREFIX + "Cannot insert row that does not match a row filter"),
node -> {
Scope accessControlScope = analysis.getAccessControlScope(table);
// hidden fields are not accessible in insert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,15 +613,15 @@ public void testInsert()

// Outside allowed row filter
assertThatThrownBy(() -> assertions.query("INSERT INTO mock.tiny.nation VALUES (26, 'POLAND', 0, 'No comment')"))
.hasMessage("Access Denied: Cannot insert row that does not match to a row filter");
.hasMessage("Access Denied: Cannot insert row that does not match a row filter");
assertThatThrownBy(() -> assertions.query("INSERT INTO mock.tiny.nation VALUES "
+ "(26, 'POLAND', 0, 'No comment'),"
+ "(27, 'HOLLAND', 0, 'A comment')"))
.hasMessage("Access Denied: Cannot insert row that does not match to a row filter");
.hasMessage("Access Denied: Cannot insert row that does not match a row filter");
assertThatThrownBy(() -> assertions.query("INSERT INTO mock.tiny.nation(nationkey) VALUES (null)"))
.hasMessage("Access Denied: Cannot insert row that does not match to a row filter");
.hasMessage("Access Denied: Cannot insert row that does not match a row filter");
assertThatThrownBy(() -> assertions.query("INSERT INTO mock.tiny.nation(regionkey) VALUES (0)"))
.hasMessage("Access Denied: Cannot insert row that does not match to a row filter");
.hasMessage("Access Denied: Cannot insert row that does not match a row filter");
}

/**
Expand Down Expand Up @@ -677,7 +677,7 @@ public void testRowFilterWithHiddenColumns()
.matches("VALUES (BIGINT '0', 'ALGERIA', BIGINT '0', ' haggle. carefully final deposits detect slyly agai')");
assertThatThrownBy(() -> assertions.query("INSERT INTO mock.tiny.nation_with_hidden_column VALUES (101, 'POLAND', 0, 'No comment')"))
.isInstanceOf(TrinoException.class)
.hasMessage("Access Denied: Cannot insert row that does not match to a row filter");
.hasMessage("Access Denied: Cannot insert row that does not match a row filter");
assertions.query("INSERT INTO mock.tiny.nation_with_hidden_column VALUES (0, 'POLAND', 0, 'No comment')")
.assertThat()
.skippingTypesCheck()
Expand Down Expand Up @@ -738,10 +738,10 @@ public void testRowFilterOnOptionalColumn()

assertThatThrownBy(() -> assertions.query("INSERT INTO mockmissingcolumns.tiny.nation_with_optional_column(nationkey, name, regionkey, comment, optional) VALUES (0, 'POLAND', 0, 'No comment', 'so')"))
.isInstanceOf(TrinoException.class)
.hasMessage("Access Denied: Cannot insert row that does not match to a row filter");
.hasMessage("Access Denied: Cannot insert row that does not match a row filter");

assertThatThrownBy(() -> assertions.query("INSERT INTO mockmissingcolumns.tiny.nation_with_optional_column(nationkey, name, regionkey, comment, optional) VALUES (0, 'POLAND', 0, 'No comment', null)"))
.isInstanceOf(TrinoException.class)
.hasMessage("Access Denied: Cannot insert row that does not match to a row filter");
.hasMessage("Access Denied: Cannot insert row that does not match a row filter");
}
}