Expand description
The normalized shape of a DDL-defined (or seeded) materialized view, and the validation shared
by the DDL executor and the registry loader.
The normalized shape of a DDL-defined (or seeded) materialized view – the three queries plus
every option – and the one validate_view_definition function shared by the DDL executor
(rust/public/src/servers/view_ddl.rs) and the registry loader (view_registry.rs), so a
definition the loader would skip can never be accepted at CREATE time in the first place.
Structs§
- View
Definition - The normalized shape of a
CREATE MATERIALIZED VIEWdefinition – every option plus the three queries – independent of whether it arrived over DDL or was seeded by a migration (log_stats_view.rs’slog_stats_view_definition). - View
Options - The non-query, non-
update_groupoptions aViewDefinitioncarries, serialized as JSON inlakehouse_view_set_definitions.view_options.update_grouplives in its own column instead (reload() sorts and the registry loader projects on it), anddefinition_sqlis the verbatim DDL text kept for display/audit only – neither belongs here.
Functions§
- build_
sql_ batch_ view - Builds the
SqlBatchViewaViewDefinitiondescribes. This is most of the validation – planning the extract query catches syntax errors, unknown tables and unknown columns, and yields the schema every later check inspects – so callers (the DDL executor, the registry loader) must call this beforevalidate_view_definition, never after. - check_
view_ set_ name_ charset - Fast, redundant, name-only pre-check – also enforced, exhaustively, by
validate_view_definition, which remains the sole enforcement point since it is the only check that also runs on rows the registry loader reads back.^[a-z_][a-z0-9_]{0,254}$, not starting with__(which would collide with a view’s own__<name>__partitionsinternal registration), and notsource(substituted for{source}in every merge query and registered on every merge’s session context). - parse_
time_ delta - Parses a
"<n> <unit>"string (e.g."1 day","2 hours") into aTimeDelta. Accepted units, singular or plural:second(s),minute(s),hour(s),day(s). - validate_
view_ definition - Every check runs before a definition’s row is written, in this one function shared by the DDL
executor and the registry loader – so a definition the loader would skip can never be
accepted at
CREATEtime in the first place.viewmust already be the result ofbuild_sql_batch_viewoverdef– constructing it is most of the validation (it plans the extract query and yields the schema every check below inspects).factoryis the factoryviewwas built against – every other definition, for the DDL executor, or only the definitions in a strictly lowerupdate_groupprocessed so far, for the registry loader – which the update-group ordering check below reads.