Parses and validates SQL identifiers before they are interpolated into a statement.
Names that reach these functions come from schema introspection or from a
caller's table reference, and adapters quote them on their way into SQL.
Quoting alone does not stop a name such as users"; DROP TABLE from
breaking out of the quotes on engines with lax quoting rules, so every
identifier must match [a-zA-Z_][a-zA-Z0-9_]* first. Adapters call
validate_identifier/2 and validate_table_parts/2 from their
validate_identifier/3 and parse_qualified_name/2 callbacks, and the
Postgres dialect checks a configured search_path with
validate_search_path!/1.
Summary
Functions
Parses a potentially schema-qualified table name into {schema, table}.
Validates that a string is a safe SQL identifier.
Validates that a string is a safe SQL identifier, raising on failure.
Validates a Postgres search_path string.
Validates all parts of a table reference (schema + table, or just table).
Functions
Parses a potentially schema-qualified table name into {schema, table}.
Returns {nil, table} for unqualified names.
Validates that a string is a safe SQL identifier.
Returns :ok if the identifier matches [a-zA-Z_][a-zA-Z0-9_]*,
or {:error, reason} otherwise.
Validates that a string is a safe SQL identifier, raising on failure.
@spec validate_search_path!(String.t()) :: :ok
Validates a Postgres search_path string.
Splits on ,, trims whitespace, and validates each part as an identifier.
Raises ArgumentError if any part is invalid.
Validates all parts of a table reference (schema + table, or just table).