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

Support quoted identifiers #114

Open
dnicolodi opened this issue Oct 25, 2022 · 4 comments
Open

Support quoted identifiers #114

dnicolodi opened this issue Oct 25, 2022 · 4 comments
Labels
enhancement New feature or request feature New feature parser Involves BQL parser proposal Request for comment on proposed changes

Comments

@dnicolodi
Copy link
Collaborator

Currently BQL uses single ' and double " quotes interchangeably as string delimiters and does not have the concept of quoted identifiers. This make is impossible to have column names that collide with BQL keywords or that contain non-alphanumeric characters. This is sometimes annoying.

Standard SQL uses single quotes ' for string literals and double quotes " for quoting identifiers. https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

Should BQL do the same? It would be a tiny patch to the parser. However, I expect this to break a fair number of user queries.

@blais, do you have an opinion?

@dnicolodi dnicolodi added enhancement New feature or request parser Involves BQL parser proposal Request for comment on proposed changes labels Oct 25, 2022
@blais
Copy link
Member

blais commented Oct 26, 2022

I think you looked into this deeper than I did and I agree with you!

@dnicolodi
Copy link
Collaborator Author

I was looking for an opinion on weather supporting the feature is worth breaking backward compatibility.

Considering that BQL queries stored in Beancount input files are extremely likely to be using ' as string delimiter because " is the Beancount string delimiter, I think the backward compatibility problem may not be so severe, but this is still a quite important syntax change.

@blais
Copy link
Member

blais commented Oct 27, 2022

I forget if I added escapes in the Beancount syntax. That's going to be crucial for this change.

@dnicolodi
Copy link
Collaborator Author

Yes, the parser supports escaping double quotes as \". For v3 we could also consider having Python-like triple quotes.

@dnicolodi dnicolodi added the feature New feature label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature New feature parser Involves BQL parser proposal Request for comment on proposed changes
Projects
None yet
Development

No branches or pull requests

2 participants