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

Silently fails when using a string with a null character #223

Open
enolan opened this issue Sep 5, 2017 · 1 comment
Open

Silently fails when using a string with a null character #223

enolan opened this issue Sep 5, 2017 · 1 comment

Comments

@enolan
Copy link

enolan commented Sep 5, 2017

Postgres can't handle strings with \0 in them. However, they are valid Haskell Text and String values. If you pass one to a postgres-simple query, the string will be silently truncated after the null.

Prelude Database.PostgreSQL.Simple Data.Text> execute conn "insert into program (name, environment) values (?,?);" ("this string \0 is cut off","echo")
1
Prelude Database.PostgreSQL.Simple Data.Text> query_ conn "select * from program" :: IO ([(Int, Text, Text)])
[(7,"this string ","echo")]

I'm not sure the best way to handle this. The simplest thing is to throw an exception.

@saurabhnanda
Copy link

Possibly related to #218 ?

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

2 participants