StaticAssertThe full screen for one client clause fragment; throws when it refuses. The label OrderBy
screens the text as an ORDER BY list; any other label screens it as a WHERE predicate. When
user is given, every entity the fragment reads must be readable by that user, unscoped
(AssertUnscopedRead). That includes the entity the clause filters: a subquery over
its base view is outside the row filter RunView applies to the outer query.
The reads come from a walk of the whole parse tree (CollectStatementReads), and the clause is refused when that walk does not account for every SELECT in the text (AssertEverySelectAccountedFor). Only the parse wrapper's own FROM item is skipped, and no CTE reference is exempt. A name reserved for the parser (AssertNoIdentifierAliasNames) and a call to a function the dialect forbids (AssertNoForbiddenFunctionCalls) are refused first.
With LeaveUnparseableToProvider, text the parser cannot read returns without a refusal;
the caller's own per-item check must refuse it instead.
Optionaluser: UserInfoOptionaloptions: ClientClauseScreenOptionsStaticAssertRefuses SQL whose SELECT keywords, outside literals, quoted identifiers and comments, differ in number from the SELECT nodes a walk of its parse tree found. A subquery the walk cannot see would otherwise go unchecked, so a mismatch fails closed.
StaticAssertRefuses a call to a function the dialect forbids in caller-supplied SQL (SQLParserDialect.CallerSQLForbiddenFunctions). Such a function runs SQL given as a string, reads files or other databases, acts on the server, or pauses the query, so the table check cannot see what it reads.
StaticAssertRefuses an identifier, quoted or bare, in the form of a name the SQL parser gives a bracket identifier it renames (SQLParser.IsIdentifierAliasName), in any case. Those names are reserved for the parser, so client SQL may not use them.
StaticAssertThe entity one FROM item reads, or null for an unqualified built-in table function that reads only its arguments. Throws for any other function or row source, and when AssertTableRefReadable refuses a table name.
Optionaluser: UserInfoStaticAssertRefuses a statement separator or a comment outside literals and quoted identifiers. A filter or sort fragment never needs either, so this cannot refuse a legitimate clause.
StaticAssertResolves a table reference against the allow-list and returns its entity; throws when it is
not an entity base view, or when user is given and lacks CanRead on that entity.
A schema-qualified reference, dbo included, must match an entity in that exact schema. An
unqualified one resolves only when the view name is unique across schemas, because the
database's default-schema resolution, not this screen, would pick which view runs.
Optionaluser: UserInfoStaticAssertRefuses an entity whose read user holds under a row filter (role row-level security). SQL
that reads the entity's base view directly, such as a subquery in a client clause or an ad-hoc
query, does not apply it; RunView on that entity does. For any other entity, a granted read
covers every row and field of its base view.
lts/5: row-level security is the only read narrowing on this line (no field-level security and no API-key row filters), so GetUserRowLevelSecurityWhereClause is the full read filter.
StaticAstTrue when a parsed AST contains a write or DDL node at any depth.
StaticBuildBuilds the base-view allow-list for a set of entities.
StaticCollectEvery FROM item in a parsed statement, and the number of SELECT nodes. The walk visits every
property of every node, so it finds a FROM list wherever the grammar puts one: a subquery in a
CASE branch, HAVING, a window's ORDER BY or PARTITION BY, a function argument, IN, EXISTS, a
set operation or a CTE body. Every FROM item is kept, even when its alias repeats. Names the
fallback parse renamed are read back through SQLParser.IdentifierAliases, which holds
only names the parser put in the tree. skip is a FROM item node to leave out (the screen's
parse wrapper).
Each FROM item records whether it reads a CTE in scope there (StatementRelation.IsCTEReference). A WITH covers its own SELECT, everything below it, and the following set-operation branches unless its SELECT is a parenthesized branch. A CTE body sees the CTEs before it, itself on SQL Server, and every CTE of a PostgreSQL WITH RECURSIVE list. Names match by the dialect's identifier rules (cteNameRules). The walk keeps a count of the CTEs of each name in scope as it goes, so its time is linear in the tree.
Optionalskip: objectStaticDialectThe parser dialect for a provider: from its PlatformKey when it has one, otherwise from its
class name. Defaults to SQL Server.
Optionalprovider: object | nullStaticIsTrue for a reference written with no schema. A schema, dbo included, is matched as written.
StaticScreenApplies AssertClauseUsesEntityBaseViews to every clause of a RunView request. A platform-specific clause has every variant screened, each under its own platform's dialect.
Optionaluser: UserInfoStaticStripRemoves the bracket, double-quote or backtick quoting around one identifier.
SECURITY — screens for SQL text that a client (or a client-saved record) supplies to RunView.
ClientClauseScreen.AssertClauseUsesEntityBaseViews is the full screen: one statement, parsed as a read-only fragment, that calls no function the dialect forbids in caller SQL and whose table references are only entity base views the acting user can read unscoped (no row filter). Base tables and system catalogs are refused. Apply it at every point where client text enters RunView: the GraphQL and REST entry points, ad-hoc list sources, and the clauses a saved view stores (at save and when the view runs).
ClientClauseScreen.AssertSingleStatementFragment is the light check the provider runs on every RunView, server-internal ones included: no statement separator and no comment outside a literal or quoted identifier. It cannot refuse a legitimate fragment, so it is safe for callers whose filters the full screen would refuse (base tables, entities the acting user cannot read).
Both use dialect-aware lexing, so a quote inside a bracket identifier (
[a']) or a PostgreSQLE'\''string cannot hide a statement the way it hides one from the keyword denylist.