pub(super) fn validate_comment_references(
fqn: &FullyQualifiedName,
comments: &[CommentStatement<Raw>],
offsets: &[usize],
main_ident: &DatabaseIdent,
obj_type: &ObjectType,
errors: &mut Vec<ValidationError>,
)Expand description
Validates that all COMMENT statements in a file reference the main object.
Processes all COMMENT statements and ensures they target either:
- The main object defined in the file, OR
- A column of the main object
This validation ensures that each object file is self-contained and doesn’t reference other objects.
§Supported Comment Types
COMMENT ON TABLE- for tables and materialized viewsCOMMENT ON VIEW- for viewsCOMMENT ON MATERIALIZED VIEW- for materialized viewsCOMMENT ON SOURCE- for sources and subsourcesCOMMENT ON SINK- for sinksCOMMENT ON CONNECTION- for connectionsCOMMENT ON SECRET- for secretsCOMMENT ON COLUMN- for columns of the main object
§Errors
Returns an error if:
- A comment references a different object
- The comment type doesn’t match the object type
- An unsupported comment type is used