pub(super) fn validate_ident(
stmt: &Statement,
fqn: &FullyQualifiedName,
main_offset: usize,
errors: &mut Vec<ValidationError>,
)Expand description
Validates that the statement’s identifier matches the expected file path structure.
Ensures that the object name in the CREATE statement matches the file name, and that any schema/database qualifiers match the directory structure.
§Validation Rules
- The object name must match the file name (without
.sqlextension) - If the statement includes a schema qualifier, it must match the parent directory name
- If the statement includes a database qualifier, it must match the grandparent directory name
§Examples
Valid mappings:
materialize/public/users.sql -> CREATE TABLE users (...)
materialize/public/users.sql -> CREATE TABLE public.users (...)
materialize/public/users.sql -> CREATE TABLE materialize.public.users (...)Invalid mappings:
materialize/public/users.sql -> CREATE TABLE customers (...) X name mismatch
materialize/public/users.sql -> CREATE TABLE private.users (...) X schema mismatch
materialize/public/users.sql -> CREATE TABLE other.public.users (...) X database mismatch