Update postgres hstore casting to handle null-terminated strings.

This is needed because ruby doesn't null terminate strings, but the PG
connection adapter does. Without this, trying to use a string containing
null in an hstore will always result in invalid SQL (Unexpected end of
 string").

I chose to truncate the string at the first \0 to be consistent with
quote_string and the native PQescapeStringConn.