Commit

f7b51f1

Reviewing a schema an AI agent designed in Schemity, I clicked one foreign key and company_id lit up with it, on both tables. The members table had UNIQUE (company_id, id). In my whole career I had never seen that constraint, so I tested why it was there. With row-level security on and working, an Acme session could not even read Globex's members. It could still assign an Acme task to one. Foreign key checks bypass the policies. The composite key refused that row. The policy never saw it. https://schemity.com/blog/postgres-composite-foreign-key-vs-row-level-security/
schemity.comPostgreSQL Composite Foreign Keys vs Row-Level Security: Which Keeps Tenants Apart? - SchemityRow-level security hides other tenants' rows, yet a foreign key can still point at one. The composite key that closes it, its three traps, and how Schemity draws it.

commit f7b51f1