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

It seems like to fail escaping Char '\NUL' #75

Open
opyapeus opened this issue Jul 13, 2019 · 0 comments
Open

It seems like to fail escaping Char '\NUL' #75

opyapeus opened this issue Jul 13, 2019 · 0 comments

Comments

@opyapeus
Copy link

Thank you for the useful library.
I have encountered sql error when using Char '\NUL' in String.
Char '\NUL' is generated by (Test.QuickCheck.arbitrary :: Test.QuickCheck.Gen String) for example.

ENVIRONMENT

  • stack resolver: lts-13.12
  • extra-deps: HDBC-postgresql-2.3.2.6
  • db backend: postgresql 11.1

REPRODUCTION CODE

※conn is my local db Connection

ghci>str = ['a', '\NUL', 'b']
ghci>str
"a\NULb"
ghci>q = Database.Relational.relation . return . Database.Relational.value $ str
ghci>q
SELECT ALL 'ab' AS f0
ghci>show q
"SELECT ALL 'a\NULb' AS f0"
ghci>Database.HDBC.Record.Query.runQuery conn (Database.Relational.relationalQuery q) ()
*** Exception: SqlError {seState = "42601", seNativeError = 7, seErrorMsg = "execute: PGRES_FATAL_ERROR: ERROR:  unterminated quoted string at or near \"'a\"\nLINE 1: SELECT ALL 'a\n                   ^\n"}

It seems like to fail escaping Char '\NUL'.
Excuse me for reporting only for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant