Skip to main content
Version: Next

normalizeViewDefinition

Callable

  • normalizeViewDefinition(definition): string

  • Strips SQL line comments and blank lines from a view definition. Comments are dropped by the database on create view anyway, and a -- comment would otherwise comment out the rest of the definition once newlines are collapsed; blank lines act as statement separators in the schema-generator's statement splitter, which would break the view DDL apart.

    Comment stripping is not string-literal aware, so a -- inside a string literal (or a--b style arithmetic) is treated as a comment — an accepted tradeoff to avoid a full SQL tokenizer.

    @see

    Parameters

    • definition: string

    Returns string