Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: CockroachDB accepts invalid characters in identifiers #26583

Open
knz opened this issue Jun 11, 2018 · 2 comments · May be fixed by #70627
Open

sql: CockroachDB accepts invalid characters in identifiers #26583

knz opened this issue Jun 11, 2018 · 2 comments · May be fixed by #70627
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)

Comments

@knz
Copy link
Contributor

knz commented Jun 11, 2018

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

@knz knz added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. A-sql-pgcompat Semantic compatibility with PostgreSQL labels Jun 11, 2018
@knz knz added this to Triage in (DEPRECATED) SQL Front-end, Lang & Semantics via automation Jun 11, 2018
@knz knz moved this from Triage to Backlog in (DEPRECATED) SQL Front-end, Lang & Semantics Jun 11, 2018
@jordanlewis jordanlewis moved this from Triage to Lower priority backlog in [DEPRECATED] Old SQLExec board. Don't move stuff here May 7, 2019
@asubiotto asubiotto moved this from Lower priority backlog to [TENT] SQL Features in [DEPRECATED] Old SQLExec board. Don't move stuff here Apr 2, 2020
@github-actions
Copy link

github-actions bot commented Jun 6, 2021

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
5 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@knz knz added this to Triage in SQL Sessions - Deprecated via automation Jun 7, 2021
@knz
Copy link
Contributor Author

knz commented Jun 7, 2021

This issue is still current as of 21.1

@rafiss rafiss moved this from Triage to Shorter term backlog in SQL Sessions - Deprecated Jun 16, 2021
@rafiss rafiss added the E-starter Might be suitable for a starter project for new employees or team members. label Jun 16, 2021
@jlinder jlinder added the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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)
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants