feat: apply RLS conservatively (#38683)

This commit is contained in:
Beto Dealmeida
2026-03-17 10:20:09 -04:00
committed by GitHub
parent 1c8224f4c6
commit a854fa60a2
6 changed files with 416 additions and 16 deletions

View File

@@ -260,12 +260,13 @@ class RLSAsSubqueryTransformer(RLSTransformer):
if node.alias:
alias = node.alias
else:
name = ".".join(
part
for part in (node.catalog or "", node.db or "", node.name)
if part
)
alias = exp.TableAlias(this=exp.Identifier(this=name, quoted=True))
# Use just the table name (not schema-qualified) so that
# column references like ``table.column`` still resolve after
# the table is replaced with a subquery. Using the full
# ``schema.table`` path as a quoted identifier creates a
# mismatch: the columns reference ``table`` but the alias is
# ``"schema.table"``, which are different identifiers.
alias = exp.TableAlias(this=exp.Identifier(this=node.name, quoted=True))
node.set("alias", None)
node = exp.Subquery(