-
Notifications
You must be signed in to change notification settings - Fork 25
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
Option for .as()
output to be wrapped in double-quotes?
#576
Comments
Looks like Mammoth tries to automatically wrap in quotes, but its heuristic is off: mammoth/workspaces/mammoth/src/naming/index.ts Lines 4 to 11 in 8122afe
From the Postgres manual (link):
So maybe we should replace the // More restrictive than strictly necessary, so we'll end up quoting some things that don't necessarily need quotes.
const isValidWithoutQuotes = /^[a-z_][A-Za-z0-9_$]*$/; |
1 similar comment
Looks like Mammoth tries to automatically wrap in quotes, but its heuristic is off: mammoth/workspaces/mammoth/src/naming/index.ts Lines 4 to 11 in 8122afe
From the Postgres manual (link):
So maybe we should replace the // More restrictive than strictly necessary, so we'll end up quoting some things that don't necessarily need quotes.
const isValidWithoutQuotes = /^[a-z_][A-Za-z0-9_$]*$/; |
A use case is if we want to give an expression an alias that includes special characters, e.g.
Right now, the generated SQL is
column_name ?column?
, which is invalid SQL. Desired output:column_name "?column?"
.Maybe related: #243
If this seems reasonable, I'm happy to work on a PR.
Maybe the usage could look like:
The text was updated successfully, but these errors were encountered: