sql: CockroachDB accepts invalid characters in identifiers #26583
Labels
A-sql-pgcompat
Semantic compatibility with PostgreSQL
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
E-starter
Might be suitable for a starter project for new employees or team members.
T-sql-foundations
SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Currently CockroachDB accepts nul and newline characters in double-quoted identifiers. It also accepts invalid UTF-8 sequences inside single-quoted identifiers.
This makes pretty-printed queries hard to read and arguably would confuse UI clients that try to display the name of the database objects.
pg's docs specify that SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_). Subsequent characters in an identifier or key word can be letters, underscores, digits (0-9), or dollar signs ($).
https://www.postgresql.org/docs/10/static/sql-syntax-lexical.html
It's probably OK if CockroachDB supports slightly more (valid UTF-8 strings, for example) but we should reject at least control characters.
Jira issue: CRDB-4999
The text was updated successfully, but these errors were encountered: