Skip to content

Commit

Permalink
row_policy_template - test for asterisk table in a dedicated file
Browse files Browse the repository at this point in the history
  • Loading branch information
ilejn committed Aug 15, 2023
1 parent 68f320c commit 9cae0c9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Policy for table `*` does not affect other tables in the database
other 100 20
11 changes: 11 additions & 0 deletions tests/queries/0_stateless/02703_row_policies_for_asterisk.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Tags: no-parallel

SELECT 'Policy for table `*` does not affect other tables in the database';
CREATE DATABASE 02703_db_asterisk;
CREATE ROW POLICY 02703_asterisk ON 02703_db_asterisk.`*` USING x=1 AS permissive TO ALL;
CREATE TABLE 02703_db_asterisk.`*` (x UInt8, y UInt8) ENGINE = MergeTree ORDER BY x AS SELECT 100, 20;
CREATE TABLE 02703_db_asterisk.`other` (x UInt8, y UInt8) ENGINE = MergeTree ORDER BY x AS SELECT 100, 20;
SELECT 'star', * FROM 02703_db_asterisk.`*`;
SELECT 'other', * FROM 02703_db_asterisk.other;
DROP ROW POLICY 02703_asterisk ON 02703_db_asterisk.`*`;
DROP DATABASE 02703_db_asterisk;
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,3 @@ None
3 30
4 40
No problematic policy, select works
Policy for table `*` does not affect other tables in the database
other 100 20
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,3 @@ DROP TABLE 02703_db.02703_rptable;
DROP TABLE 02703_db.02703_rptable_another;
DROP TABLE 02703_db.02703_unexpected_columns;
DROP DATABASE 02703_db;

SELECT 'Policy for table `*` does not affect other tables in the database';
CREATE DATABASE 02703_db_asterisk;
CREATE ROW POLICY 02703_asterisk ON 02703_db_asterisk.`*` USING x=1 AS permissive TO ALL;
CREATE TABLE 02703_db_asterisk.`*` (x UInt8, y UInt8) ENGINE = MergeTree ORDER BY x AS SELECT 100, 20;
CREATE TABLE 02703_db_asterisk.`other` (x UInt8, y UInt8) ENGINE = MergeTree ORDER BY x AS SELECT 100, 20;
SELECT 'star', * FROM 02703_db_asterisk.`*`;
SELECT 'other', * FROM 02703_db_asterisk.other;
DROP ROW POLICY 02703_asterisk ON 02703_db_asterisk.`*`;
DROP DATABASE 02703_db_asterisk;

0 comments on commit 9cae0c9

Please sign in to comment.