mirror of
https://github.com/archtechx/tenancy.git
synced 2026-08-06 06:54:03 +00:00
perf(rls): wrap current_setting() in the generated tenant policy for per-statement eval
This commit is contained in:
parent
7a1a2162ac
commit
a09ea63967
1 changed files with 2 additions and 2 deletions
|
|
@ -279,7 +279,7 @@ test('trait rls manager generates queries correctly', function() {
|
||||||
expect($manager->generateQueries())->toContain(
|
expect($manager->generateQueries())->toContain(
|
||||||
<<<SQL
|
<<<SQL
|
||||||
CREATE POLICY posts_rls_policy ON posts USING (
|
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,
|
||||||
<<<SQL
|
<<<SQL
|
||||||
|
|
@ -287,7 +287,7 @@ test('trait rls manager generates queries correctly', function() {
|
||||||
post_id IN (
|
post_id IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM posts
|
FROM posts
|
||||||
WHERE tenant_id::text = current_setting('my.current_tenant')
|
WHERE tenant_id::text = (select current_setting('my.current_tenant'))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
SQL,
|
SQL,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue