[storm] suspected bug in storm array implementation
Andreas Kopecky
andreas.kopecky at meduniwien.ac.at
Mon Nov 2 11:18:41 GMT 2009
Hi,
I think i found a little bug in the implementation for array data
type in the postgres module of storm. Obviously postgres needs an
explicit type cast there when one tries to insert a list of null
values in a typed array column
example:
given a table like:
create table bogus(
realvalues real[]
);
defining a storm class for it:
>>> class Bogus(Storm):
... realvalues List(type=Float())
bogus = Bogus()
if you now set the realvalues property to a list of None values
>>> bogus.realvalues = [None, None]
storm tries to execute an sql statement akin to
update set realvalues = array[Null, Null];
which results in an operational error since postgres can not
autodetect the type of null values and defaults each untyped
array to Text[]
A fix for this would be to (instead of the update statement above)
us:
update set realvalues = cast(array[Null, Null] as real[]);
Sadly i havent found a good way to do type casts using storm syntax
so the only fix i can offer would be to do it 'manually' and add a
translation table for StormVariable types to SQL datatyped that can be
used to produce type casts in the 'compile_list_variable' function.
If wished i can provide such.
- regards, andreas kopecky
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 550 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/storm/attachments/20091102/914486dd/attachment-0001.pgp
More information about the storm
mailing list