Skip to content

Commit

Permalink
Improve insert row filter violation message grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Nov 21, 2022
1 parent 5a8220c commit 9a4497e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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");
}
}

0 comments on commit 9a4497e

Please sign in to comment.