## Problem
`enrichLintsQuery` in `packages/pg-meta/src/sql/studio/advisor/lints.ts`
only emitted `set local pgrst.db_schemas = ...` when `exposedSchemas`
was truthy. When the Data API is off (empty string), it emitted nothing.
The current lints rely on an unset `pgrst.db_schemas` yielding an empty
list. That only works with pg-meta's older copy of splinter. Newer
splinter falls back to `public` when the setting is unset, so once
pg-meta upgrades its splinter copy, projects with the Data API off would
get false exposure findings. Pooled backends that were reused after a
migration check can also read `''`, so relying on "unset" is unreliable.
Link:
https://linear.app/supabase/issue/FE-4708/pg-meta-lints-set-pgrstdb-schemas-when-the-data-api-is-off
## Solution
- An empty string now emits `set local pgrst.db_schemas = '';`.
- `undefined` is intentionally unchanged and still emits nothing.
This should land before the splinter copy upgrade.
## Review instructions
1. Run `pnpm vitest run test/sql/studio/lints.test.ts` in
`packages/pg-meta`. All 4 tests should pass.
2. Confirm that `enrichLintsQuery(query, '')` includes `set local
pgrst.db_schemas = '';` and that `enrichLintsQuery(query, undefined)`
includes no `pgrst.db_schemas` statement.
## Checklist
Check all before review:
- [ ] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Refactor**
* Improved SQL construction across the studio to make queries safer and
more consistent.
* Safer parameter handling for optional schema and remediation links to
prevent injection risks.
* Deterministic query header formatting and stable date/comments in
generated SQL.
* More robust user-count and paginated-user queries for accurate counts,
sorting and pagination.
* Updated tests to align with the new safe query handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Context
Shifts all remaining dashboard queries into pg-meta so that we
centralize all manually written queries in one place
Having them in packages/pg-meta also allows us to write tests for them
## To test
Just needs a smoke test on
- Role Impersonation
- Lints
- Data API
- Database
- Enumerated Types
- Integrations
- Foreign Data Wrappers
- Vault