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.
Postgres can't handle strings with \0 in them. However, they are valid Haskell
Text
andString
values. If you pass one to apostgres-simple
query, the string will be silently truncated after the null.I'm not sure the best way to handle this. The simplest thing is to throw an exception.