ADD FILTER
Syntax
Syntax
ALTER TABLE <table> ADD FILTER [<Filter_Name>] (<condition>);
<table>
The table you want to add a filter on
<Filter_Name> (optional)
You can define a filter name
when a user doesn't define any filter name, the default name is <table><#> where <#> is the next available filter number (starting at 0)
<condition>
Condition using only the table into account
Use a where clause condition : WHERE ColumnX = ValueX
example
ALTER TABLE my_test ADD FILTER ( WHERE ival > 20);
example
ALTER TABLE my_test ADD FILTER ( WHERE authorized_User = current_user);
Filtering using an extra table (with a JOIN)
Syntax is:
INNER JOIN myschema.TableY ON (Join conditions)
Even if the syntax is correct, for performance reasons, it is recommended not to use any "where clause" in that context. Prefer including all conditions into the ON clause.
For performance reasons, it is highly recommended to create the table used in the JOIN clause as a dimension table.
example
ALTER TABLE my_test ADD FILTER (
JOIN filter_table
on (my_test.entity= filter_table.entity
AND current_user = filter_table.manager)
);
Output
This SQL command does not return anything