Docs
  • 0.57.0latest
  • 0.56.0
  • 0.55.0
  • 0.54.0
  • 0.53.0
  • 0.52.1
  • 0.52.0
  • 0.51.0
  • 0.48.0
  • 0.47.0
  • 0.46.0
  • 0.45.0
  • 0.44.0
  • 0.43.0
  • 0.42.0
  • 0.41.0
  • 0.40.0
  • 0.39.6
  • 0.39.5
  • 0.39.3
  • 0.39.2
  • 0.39.1
  • 0.39.0
  • 0.38.4
  • 0.38.2
  • 0.38.1
  • 0.37.1
  • 0.37.0
  • 0.36.2
  • 0.36.1
  • 0.36.0
  • 0.35.3
  • 0.35.2
  • 0.35.1
  • 0.35.0
  • 0.34.4
  • 0.34.3-beta
  • 0.34.2-beta
  • 0.34.1-beta
  • 0.34.0-beta
  • 0.33.4-beta
  • 0.33.3-beta
  • 0.33.2-beta
  • 0.33.1-beta
  • 0.33.0-beta
  • 0.32.0-beta

Row security

A grant narrows to the rows a predicate reaches: GRANT … WHERE (…) carries the predicate, and ALTER TABLE … ENABLE ROW SECURITY turns the enforcement on.

One sentence carries this whole page:

GRANT … WHERE (<predicate>) narrows a grant to the rows the predicate reaches, and ALTER TABLE … ENABLE ROW SECURITY decides whether the narrowing is enforced at all.

Without the switch the predicates store but never act — a table opts in one statement at a time, and opting out is the same statement backwards.

The predicate on the grant

A grant names a user and a table; it may also carry a TessariQL predicate in parentheses, written where the grant is written:

GRANT read ON orders WHERE (tenant = 'a') TO ada;

The predicate is plain TessariQL — the same expressions a WHERE clause takes, pattern operators included. There is no second policy language to learn, and nothing here weakens what grants already were: a user with even one grant reaches exactly what their grants reach, now row by row.

Guards on one user and table AND. Two guarded grants admit the rows both predicates admit, so ada with

GRANT read ON orders WHERE (tenant = 'a') TO ada;
GRANT read ON orders WHERE (total > 100) TO ada;

reads the orders that are both her tenant's and over a hundred — and the statements above her reach nothing she could not read before the feature existed.

A predicate that compares across what a record holds refuses where it is written, like any condition. And kinds that hold no rows refuse the guard by name: GRANT read ON some_queue WHERE (true) TO ada; answers RowGuardsOnKind — buckets, queues and vaults have no rows to guard.

The switch

ALTER TABLE orders ENABLE ROW SECURITY;
ALTER TABLE orders DISABLE ROW SECURITY;

The switch is owner-held and per table, and it is the whole difference between stored and enforced. With the switch off — the default for every table that never named it — guarded grants parse, store and report themselves, and a read answers exactly as it always did. This is deliberate: predicates can be written and inspected before they ever stand between a statement and its rows.

INFO FOR TABLE orders answers row_security: true beside the shape, and INFO FOR USER ada carries each guard text beside the verbs it narrows.

What enforcement means

With the switch on, enforcement sits at the session layer — below every client, on every answer-producing path.

  • Reads filter. A scan, an index-served read, an identity or key read, a join, a traversal, PATH TO, a gathered fold, a FETCH — every path resolves the guards once and answers only the rows they admit. A row outside the predicates is indistinguishable from a row that does not exist: it is absent from the answer, not present and redacted.
  • Writes stage both ways. A create is checked against the new row; an update against the located row and the row it becomes; a delete against the row about to go. A write that lands outside the guards is refused — RowGuardDenied — so a guarded writer can neither pull rows toward herself nor push them away.
  • Failure refuses, closed. A stored predicate that no longer evaluates — a field it named was dropped — refuses the statement with RowGuardInvalid. Evaluation failure never widens or narrows silently; the statement stops, named.
  • The feed filters too. A subscription with a guarded reader delivers only the rows the guards reach; a row written outside them never arrives.

The change feed and every client see the same rows because there is one check, not one per surface. And on a cluster the definitions ride the catalog the way every definition does: a grant written on one node enforces on every node that replays it, including the one that takes over after a failover.

In the console

The console's Access screen carries the row-security pane: which tables enforce, the guard texts held over each, the switch, and the grant dialog's Rows field for writing a guarded grant from the form. The pane is a client like any other — the node answers its list, and refuses its changes, with the signed-in caller's own authority.