Skip to content
Reeflow
Start Building

Row-level security

Row-level security (RLS) filters query results based on who is querying. Unlike connection and table security which gate access entirely, RLS shapes what data is returned by injecting filters into every query.

Row filters are defined as column-value pairs. When a query runs, Reeflow injects these filters as WHERE clauses, restricting results to rows that match the filter conditions.

For example, a filter tenant_id = RF_USER_ATTR('tenant_id') on the orders table transforms:

SELECT * FROM orders

Into:

SELECT * FROM orders WHERE tenant_id = 'acme'

The value 'acme' comes from the principal’s tenant_id attribute, resolved at query time.

RF_USER_ATTR('attribute_name') resolves to the principal’s user attribute value at query time. This is what makes RLS dynamic: instead of hardcoding filter values, you reference attributes that are set when the session is created or configured on the user or role.

For example, tenant_id = RF_USER_ATTR('tenant_id') ensures each tenant only sees their own rows without creating separate roles for each tenant.

For complete syntax and allowed locations, see the SQL functions reference.

BehaviorDescription
Query injectionFilters are added as WHERE clauses to every query on the table.
Multiple filtersAll filters combine with AND logic. Rows must match every filter.
Missing attributesIf RF_USER_ATTR() references an attribute the principal doesn’t have, the query fails with an error.
NULL handlingStandard SQL equality applies. Rows with NULL in the filtered column are excluded because NULL = value evaluates to false.
Global filtersFilters can apply to all tables using the wildcard (*) table scope.

Configure row filters in the Console

Add row filters to restrict which rows a role can access. The value field supports RF_USER_ATTR() for dynamic filtering based on user attributes.

  1. Navigate to Roles and open a role for editing
  2. Expand Connections and enable the Query action
  3. Click Configure on a connection
  4. Expand Row Filters and click Add Row Filter
  5. Select a table (or “All Tables” for global filters), column, and value
Row filter configuration showing table, column, and value fields
Row filter configuration showing table, column, and value fields
ScenarioResult
No rows match filtersSuccess with empty result set (standard SQL WHERE behavior)
RF_USER_ATTR() references missing attribute400 Bad Request with “Attribute ‘attributeName’ not found in context”