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:
parent
a09ea63967
commit
61410b52d4
1 changed files with 6 additions and 6 deletions
|
|
@ -582,7 +582,7 @@ test('table rls manager generates queries correctly', function() {
|
||||||
expect(array_values(app(TableRLSManager::class)->generateQueries()))->toEqualCanonicalizing([
|
expect(array_values(app(TableRLSManager::class)->generateQueries()))->toEqualCanonicalizing([
|
||||||
<<<SQL
|
<<<SQL
|
||||||
CREATE POLICY authors_rls_policy ON authors USING (
|
CREATE POLICY authors_rls_policy ON authors USING (
|
||||||
tenant_id::text = current_setting('my.current_tenant')
|
tenant_id::text = (select current_setting('my.current_tenant'))
|
||||||
);
|
);
|
||||||
SQL,
|
SQL,
|
||||||
<<<SQL
|
<<<SQL
|
||||||
|
|
@ -590,7 +590,7 @@ test('table rls manager generates queries correctly', function() {
|
||||||
author_id IN (
|
author_id IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM authors
|
FROM authors
|
||||||
WHERE tenant_id::text = current_setting('my.current_tenant')
|
WHERE tenant_id::text = (select current_setting('my.current_tenant'))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
SQL,
|
SQL,
|
||||||
|
|
@ -602,7 +602,7 @@ test('table rls manager generates queries correctly', function() {
|
||||||
WHERE author_id IN (
|
WHERE author_id IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM authors
|
FROM authors
|
||||||
WHERE tenant_id::text = current_setting('my.current_tenant')
|
WHERE tenant_id::text = (select current_setting('my.current_tenant'))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -652,7 +652,7 @@ test('table rls manager generates queries correctly', function() {
|
||||||
expect(app(TableRLSManager::class)->generateQueries($paths))->toContain(
|
expect(app(TableRLSManager::class)->generateQueries($paths))->toContain(
|
||||||
<<<SQL
|
<<<SQL
|
||||||
CREATE POLICY primaries_rls_policy ON primaries USING (
|
CREATE POLICY primaries_rls_policy ON primaries USING (
|
||||||
tenant_id::text = current_setting('my.current_tenant')
|
tenant_id::text = (select current_setting('my.current_tenant'))
|
||||||
);
|
);
|
||||||
SQL,
|
SQL,
|
||||||
<<<SQL
|
<<<SQL
|
||||||
|
|
@ -660,7 +660,7 @@ test('table rls manager generates queries correctly', function() {
|
||||||
primary_id IN (
|
primary_id IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM primaries
|
FROM primaries
|
||||||
WHERE tenant_id::text = current_setting('my.current_tenant')
|
WHERE tenant_id::text = (select current_setting('my.current_tenant'))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
SQL,
|
SQL,
|
||||||
|
|
@ -672,7 +672,7 @@ test('table rls manager generates queries correctly', function() {
|
||||||
WHERE primary_id IN (
|
WHERE primary_id IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM primaries
|
FROM primaries
|
||||||
WHERE tenant_id::text = current_setting('my.current_tenant')
|
WHERE tenant_id::text = (select current_setting('my.current_tenant'))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue