Expand description
SQL identifier validation and quoting.
Two profile-aware validators:
is_valid_identifier- strictPostgreSQL: ASCII alnum +_, <= 63 chars, no leading digit. Use for column names emitted by schema inference / DDL generation and any name spliced intoCREATE TABLE/ binaryCOPY.is_valid_identifier_with_hyphen- relaxed PG-safe: ASCII alnum +_+-, <= 63 chars, no leading digit. Use for operator-supplied schema/table names where hyphens are valid elsewhere (e.g. Unity Catalog / Delta naming) but still need to be safe to splice into PG SQL afterquote_identifierwraps the name.
Both should be paired with quote_identifier before emitting SQL -
never splice a raw string. The validators reject Unicode alphanumerics
on purpose: Postgres accepts UTF-8 in quoted identifiers, but Unicode
confusables make injection auditing harder.
Functions§
- is_
valid_ identifier - Validates a strict
PostgreSQLidentifier (schema/table/column name). - is_
valid_ identifier_ with_ hyphen - Validates a relaxed
PostgreSQLidentifier that also allows hyphens. - quote_
identifier - Quotes and escapes a
PostgreSQLidentifier.