Row Level Security, aka "RLS," allows a database administrator to define if a user should be able to view or manipulate specific rows of data within a table according to a policy. Introduced in PostgreSQL 9.5, row level security added another layer of security for PostgreSQL users who have additional security and compliance considerations for their applications.
At Crunchy Data, we care a lot about data security and supporting PostgreSQL. When we discovered an issue with creating a large row level security policy, we worked to find a workaround that provided a secure outcome but avoided creating a custom fork of PostgreSQL. As of the publication of this post, the Crunchy Data team is working to address the issue with a patch that will be submitted for inclusion upstream.
To understand the issue and how our team found a solution, I'll first give a quick primer of how row level security works in PostgreSQL.