1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-08-06 05:54:03 +00:00

perf(rls): wrap current_setting() in the generated tenant policy for per-statement eval

This commit is contained in:
Dmitry Maranik 2026-07-03 19:36:12 -07:00
parent 7a1a2162ac
commit a09ea63967

View file

@ -279,7 +279,7 @@ test('trait rls manager generates queries correctly', function() {
expect($manager->generateQueries())->toContain(
<<<SQL
CREATE POLICY posts_rls_policy ON posts USING (
tenant_id::text = current_setting('my.current_tenant')
tenant_id::text = (select current_setting('my.current_tenant'))
);
SQL,
<<<SQL
@ -287,7 +287,7 @@ test('trait rls manager generates queries correctly', function() {
post_id IN (
SELECT id
FROM posts
WHERE tenant_id::text = current_setting('my.current_tenant')
WHERE tenant_id::text = (select current_setting('my.current_tenant'))
)
);
SQL,