This repository has been archived by the owner on Sep 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
escape.ident should quote identifiers that have capital letters #22
Open
jedwards1211 opened this issue
Jun 9, 2021
· 5 comments
· Fixed by maybephilipp/pg-escape#2 · May be fixed by #24
Open
escape.ident should quote identifiers that have capital letters #22
jedwards1211 opened this issue
Jun 9, 2021
· 5 comments
· Fixed by maybephilipp/pg-escape#2 · May be fixed by #24
Comments
hi. why is this not merged yet ? |
actually I don't know why I bothered making a PR, the last commit was in 2015 so project is probably dead |
something is fishy cause I see allot of weekly downloads 19,017 , that means people is using it. |
yeah, though people can keep using an abandoned package, it happens |
also that's funny that someone already made a PR, wish I had noticed 😂 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Expected behavior:
escape.ident('Foo') === '"Foo"'
Actual behavior:
escape.ident('Foo') === 'Foo'
If we had
pool.query(`CREATE DATABASE ${escape.ident(name)}`)
, andname
is'Foo'
, the created database would have the namefoo
instead since Postgres lowercases unquoted identifiers.I'm not even sure if
name.toLowerCase() !== name
would be a sufficient to decide whether to quote because who knows if JS lowercases all the same non-Latin characters as Postgres does? I think the safest bet would be to add double quotes if the name doesn't match/^[a-z_][a-z0-9_$]*$/
(case sensitive)The text was updated successfully, but these errors were encountered: