You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature: expose source_tables on Query proto for plugin access to full query table dependencies #4434
Plugins receive Query.columns[].table which only covers tables contributing
to SELECT output. Tables referenced only in subqueries, CTEs, or JOINs are
invisible to plugins.
Example — plugin only sees accounts, misses account_tags and transactions:
-- name: ListSpaceAccounts :many
WITH filtered_accounts AS (
SELECT account_id FROM accounts WHERE space_id = ?
AND NOT EXISTS (
SELECT1FROM account_tags t WHEREt.account_id=accounts.account_id
)
)
SELECT acc.*FROM accounts acc
JOIN filtered_accounts fa ONacc.account_id=fa.account_idLEFT JOIN transactions t ONt.debit_account_id=acc.account_id
Use case
SQLite's update_hook fires with the name of the written table. Frontend plugins
generating reactive query stores need every table a query depends on — not just
output columns — to know when to refetch. Currently the only workaround is running sqlc parse as a separate post-codegen script outside the plugin WASM sandbox.
Proposed change
Add source_tables to the Query proto:
messageQuery {
// ... existing fields ...repeatedstringsource_tables=7; // all tables this query reads from, CTEs excluded
}
sqlc's analyzer already resolves this internally when validating joins and column
references — this only surfaces existing data through the proto, no new analysis needed.
Activity