Skip to content

    Row-level security (RLS)

    Data integration & searchRLSRow-Level Security
    Reading time: 2 min.Editorially reviewed on:

    Definition

    Row-level access control limits database access to the records that a given role is allowed to use.

    Row-level access control complements general table permissions with rules for individual records. A database checks which rows are visible or modifiable. In PostgreSQL, policies can differentiate by role and operation; special privileged roles can bypass these controls.

    Simply explained

    Multiple people use the same table but see only the rows that are authorized for them. The check takes place in the database.

    Why it matters in practice

    RLS supports the separation of customer data or responsibilities within shared tables and reduces reliance on pure surface filters.

    Example from business

    Possible example: A customer portal stores orders jointly but allows logged-in customers access only to the records assigned to their organization.

    Limits and pitfalls

    • A filter in the interface does not replace a database rule. Owner or privileged roles may have exceptions; reading and writing must be secured accordingly.

    Origin & history

    Database systems supplement table-level rights with record-based policies so that shared tables remain controllably usable for different roles.

    Use in mid-sized companies

    • Companies can centrally store tenant rules and check with various roles whether foreign records can neither be read nor modified.

    Frequently asked questions

    What happens in PostgreSQL without an appropriate policy?

    If RLS is enabled and no policy exists, a default deny rule generally applies to normal accesses; privileged exceptions must still be considered.

    Sources

    Editorially reviewed on:

    On this page

    Next step

    Put knowledge into practice