[storm] psycopg2-2.2, Storm, and ENUMs
James Henstridge
james at jamesh.id.au
Tue May 25 09:46:11 BST 2010
On Tue, May 25, 2010 at 9:11 AM, James Henstridge <james at jamesh.id.au> wrote:
> On Tue, May 25, 2010 at 12:15 AM, Dan Halbert <halbert at halwitz.org> wrote:
>>
>>
>> On Monday, May 24, 2010 11:35am, "James Henstridge" <james at jamesh.id.au>
>> said:
>>
>>> On Sat, May 22, 2010 at 3:06 AM, Dan Halbert <halbert at halwitz.org> wrote:
>>> > Psycopg2-2.2 now adds explicit casts to strings in places where it did
>>> > not before.
>>> > ...
>>> > This change causes several storm tests to break for type conversion
>>> > reasons.
>>
>> *** That the above change caused the storm test breakage perhaps got lost in
>> my following verbiage
>> and is probably the more important point. It will be necessary to fix the
>> storm tests to work with psycopg2-2.2.
>
> Thanks for the heads up. I'll try to take a look at it soon.
Below is the list of errors with the latest psycopg2.
For the test_case_default_like, test_case_sensitive_like and
test_case_insensitive_like tests, you could argue that those tests
should be using unicode strings. For
test_get_insert_identity_composed use a unicode variable. For
test_set_decimal_property, the DecimalVariable uses a byte string as
the database representation, which might need to change.
Overall, the changes required probably aren't that large. That said,
I wouldn't be surprised if these psycopg2 changes cause problems for
other projects so it might be worth waiting to see if anything changes
on that side.
James.
======================================================================
ERROR: test_case_default_like (tests.databases.postgres.PostgresTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/james/src/storm/storm.trunk/tests/mocker.py", line 102,
in test_method_wrapper
result = test_method()
File "/home/james/src/storm/storm.trunk/tests/databases/postgres.py",
line 272, in test_case_default_like
result = self.connection.execute(expr)
File "/home/james/src/storm/storm.trunk/storm/databases/postgres.py",
line 249, in execute
return Connection.execute(self, statement, params, noresult)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
237, in execute
raw_cursor = self.raw_execute(statement, params)
File "/home/james/src/storm/storm.trunk/storm/databases/postgres.py",
line 259, in raw_execute
return Connection.raw_execute(self, statement, params)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
321, in raw_execute
self._check_disconnect(raw_cursor.execute, *args)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
366, in _check_disconnect
return function(*args, **kwargs)
ProgrammingError: operator does not exist: text ~~ bytea
LINE 1: ...FROM like_case_insensitive_test WHERE description LIKE E'%hu...
^
HINT: No operator matches the given name and argument type(s). You
might need to add explicit type casts.
======================================================================
ERROR: test_case_insensitive_like (tests.databases.postgres.PostgresTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/james/src/storm/storm.trunk/tests/mocker.py", line 102,
in test_method_wrapper
result = test_method()
File "/home/james/src/storm/storm.trunk/tests/databases/postgres.py",
line 296, in test_case_insensitive_like
result = self.connection.execute(expr)
File "/home/james/src/storm/storm.trunk/storm/databases/postgres.py",
line 249, in execute
return Connection.execute(self, statement, params, noresult)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
237, in execute
raw_cursor = self.raw_execute(statement, params)
File "/home/james/src/storm/storm.trunk/storm/databases/postgres.py",
line 259, in raw_execute
return Connection.raw_execute(self, statement, params)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
321, in raw_execute
self._check_disconnect(raw_cursor.execute, *args)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
366, in _check_disconnect
return function(*args, **kwargs)
ProgrammingError: operator does not exist: text ~~* bytea
LINE 1: ...FROM like_case_insensitive_test WHERE description ILIKE E'%h...
^
HINT: No operator matches the given name and argument type(s). You
might need to add explicit type casts.
======================================================================
ERROR: test_case_sensitive_like (tests.databases.postgres.PostgresTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/james/src/storm/storm.trunk/tests/mocker.py", line 102,
in test_method_wrapper
result = test_method()
File "/home/james/src/storm/storm.trunk/tests/databases/postgres.py",
line 284, in test_case_sensitive_like
result = self.connection.execute(expr)
File "/home/james/src/storm/storm.trunk/storm/databases/postgres.py",
line 249, in execute
return Connection.execute(self, statement, params, noresult)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
237, in execute
raw_cursor = self.raw_execute(statement, params)
File "/home/james/src/storm/storm.trunk/storm/databases/postgres.py",
line 259, in raw_execute
return Connection.raw_execute(self, statement, params)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
321, in raw_execute
self._check_disconnect(raw_cursor.execute, *args)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
366, in _check_disconnect
return function(*args, **kwargs)
ProgrammingError: operator does not exist: text ~~ bytea
LINE 1: ...FROM like_case_insensitive_test WHERE description LIKE E'%hu...
^
HINT: No operator matches the given name and argument type(s). You
might need to add explicit type casts.
======================================================================
ERROR: test_get_insert_identity_composed (tests.databases.postgres.PostgresTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/james/src/storm/storm.trunk/tests/mocker.py", line 102,
in test_method_wrapper
result = test_method()
File "/home/james/src/storm/storm.trunk/tests/databases/base.py",
line 212, in test_get_insert_identity_composed
result = self.connection.execute(select)
File "/home/james/src/storm/storm.trunk/storm/databases/postgres.py",
line 249, in execute
return Connection.execute(self, statement, params, noresult)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
237, in execute
raw_cursor = self.raw_execute(statement, params)
File "/home/james/src/storm/storm.trunk/storm/databases/postgres.py",
line 259, in raw_execute
return Connection.raw_execute(self, statement, params)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
321, in raw_execute
self._check_disconnect(raw_cursor.execute, *args)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
366, in _check_disconnect
return function(*args, **kwargs)
ProgrammingError: operator does not exist: character varying = bytea
LINE 1: ... = (SELECT currval('test_id_seq')) AND test.title = E'Title ...
^
HINT: No operator matches the given name and argument type(s). You
might need to add explicit type casts.
======================================================================
ERROR: test_set_decimal_property (tests.store.postgres.PostgresStoreTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/james/src/storm/storm.trunk/tests/mocker.py", line 102,
in test_method_wrapper
result = test_method()
File "/home/james/src/storm/storm.trunk/tests/store/base.py", line
5498, in test_set_decimal_property
self.store.flush()
File "/home/james/src/storm/storm.trunk/storm/store.py", line 490, in flush
self._flush_one(obj_info)
File "/home/james/src/storm/storm.trunk/storm/store.py", line 552,
in _flush_one
self._connection.execute(expr, noresult=True)
File "/home/james/src/storm/storm.trunk/storm/databases/postgres.py",
line 249, in execute
return Connection.execute(self, statement, params, noresult)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
237, in execute
raw_cursor = self.raw_execute(statement, params)
File "/home/james/src/storm/storm.trunk/storm/databases/postgres.py",
line 259, in raw_execute
return Connection.raw_execute(self, statement, params)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
321, in raw_execute
self._check_disconnect(raw_cursor.execute, *args)
File "/home/james/src/storm/storm.trunk/storm/database.py", line
366, in _check_disconnect
return function(*args, **kwargs)
ProgrammingError: column "value" is of type numeric but expression is
of type bytea
LINE 1: UPDATE money SET "value"=E'12.3456'::bytea WHERE money.id = ...
^
HINT: You will need to rewrite or cast the expression.
----------------------------------------------------------------------
Ran 2432 tests in 187.267s
FAILED (errors=5)
More information about the storm
mailing list