pghstore-clj
pghstore-clj copied to clipboard
Escaping double-quotes with hstore.
Typically a double-quote is no big deal inside of a PostgreSQL string - e.g. 'Hello "World"' is a perfectly fine value and doesn't need escaping.
However, when inserted into an hstore value, this isn't the case. Double-quotes cause a big problem.
Would a patch that substitutes these be accepted?
So you'd like to single quote the hstore values instead of double quoting? I'm confused how that would help the situation, especially if you start inserting strings that contain single quotes. Am I understanding the problem correctly?
Do you have an error you can show? I'm still a little fuzzy on the problem.
No, I'd just like to escape double quotes in the SQL. Currently, something like so doesn't work:
(to-hstore {:somekey "some\"value"})
; => #<PGobject "somekey"=>"some"value">
; => PostgreSQL will barf on that
Whereas this will work
(to-hstore {:somekey "some\\\"value"})
; => #<PGobject "somekey"=>"some\"value">
I just think that pghstore should do that for me, since it is a need specific to hstore columns.