Skip to content

AZ113: A name rowstile keeps for itself ​

Names that start with authz__ are rowstile's own. Where a condition is placed, its row has an alias, and this.column is written with it. When a query inside the condition could call one of its tables by that alias (select 1 from app.users u where the row is u too), the row is called authz__this there instead, so that this. still names the row. A condition that wrote such a name could take it back: call the table, the column or the function something else.

Reported when the policy is compiled: rowstile check, the editor, rowstile dev.

The mistake ​

authz
app role app_user
type user = app.users
type folder = app.folders
  owner : user = owner_id
  can view = owner and {not exists (select 1 from app.folder_links authz__l where authz__l.folder_id = this.id)}
line 5: {not exists (select 1 from app.folder_links authz__l where authz__l.folder_id = this.id)} names authz__l: names that start with authz__ are rowstile's own (where a query of the condition's could hide the row's alias, the row is called authz__this); call it something else [AZ113]

Fixed ​

authz
app role app_user
type user = app.users
type folder = app.folders
  owner : user = owner_id
  can view = owner and {not exists (select 1 from app.folder_links l where l.folder_id = this.id)}