On Jun 25, 2013, at 2:13 PM, Ryan Kelly <[email protected]> wrote:
> As we're trying to convert from our own homegrown version of the HSTORE
> type, it seems that our tests have been broken by SQLAlchemy's handling
> of serialization/de-serialization for hstores containing backslashes.
>
> The current serialization behavior of SQLAlchemy will do this:
> {'\\"a': '\\"1'} => '"\\\\"a"=>"\\\\"1"'
>
> Trying to de-serialize the result yields:
> ValueError: After '"\\\\"a"=>"\\\\"', could not parse residual at position
> 12: '1"'
>
> This is using the _serialize_hstore and _parse_hstore functions.
>
> The correct behavior, I believe, should be this:
> {'\\"a': '\\"1'} => '"\\\\\\"a"=>"\\\\\\"1"'
>
> Trying to de-serialize the result yields:
> '"\\\\\\"a"=>"\\\\\\"1"' => {'\\"a': '\\"1'}
>
> Which is what we're looking for. Attached is a patch and tests.
sure makes it easy for me, thanks! I have this queued up at
http://www.sqlalchemy.org/trac/ticket/2766 .
>
> There are also some other parsing problems that I consider to be corner
> cases and broken as implemented in PostgreSQL, such as:
>
> (postgres@[local]:5432 14:05:43) [dev]> select 'a=>,b=>'::hstore;
> (postgres@[local]:5432 14:05:47) [dev]> select 'a=>, b=>'::hstore;
> (postgres@[local]:5432 14:06:45) [dev]> select 'a=> , b=>'::hstore;
> (postgres@[local]:5432 14:06:48) [dev]> select 'a=> ,b=>'::hstore;
> (postgres@[local]:5432 14:06:50) [dev]> select 'a=>,'::hstore;
> (postgres@[local]:5432 14:10:12) [dev]> select ',=>,'::hstore;
>
> None of which are parsed by SQLAlchemy but some of which are parsed by
> PostgreSQL.
Posgresql or psycopg2 ? isn't the serialization here normally done "natively"
if you're on a more recent psycopg2?
> You can see the bug report I filed about some of them here:
> http://www.postgresql.org/message-id/[email protected]
>
> -Ryan P. Kelly
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> <hstore_serialize_deserialize_slashes_quotes.patch>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.