In() casts str strings differently to ==
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
Medium
|
Stuart Bishop | ||
Storm |
Invalid
|
Undecided
|
Unassigned |
Bug Description
With Storm 0.18 and PostgreSQL 8.4, the following works as you expect:
>>> store.find(Person, Person.name == 'stub').first()
<Person at 0x7dbd750 stub (Stuart Bishop)>
However, if we use In(), the string is converted to binary rather than text:
>> store.find(Person, In(Person.name, ['stub'])).first()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/
return self._any()
File "/home/
result = self._store.
File "/home/
return Connection.
File "/home/
raw_cursor = self.raw_
File "/home/
return Connection.
File "/home/
self.
File "/home/
return function(*args, **kwargs)
ProgrammingError: operator does not exist: text = bytea
LINE 1: ..., Person.visibility FROM Person WHERE Person.name IN (E'stub...
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Related branches
- Launchpad code reviewers: Pending requested
-
Diff: 2644 lines (+362/-446)44 files modifiedlib/canonical/launchpad/database/account.py (+7/-7)
lib/canonical/launchpad/database/stormsugar.py (+1/-19)
lib/canonical/launchpad/database/tests/test_stormextensions.py (+0/-101)
lib/canonical/launchpad/helpers.py (+45/-0)
lib/canonical/launchpad/vocabularies/dbobjects.py (+7/-2)
lib/canonical/launchpad/webapp/pgsession.py (+16/-14)
lib/canonical/launchpad/webapp/vocabulary.py (+5/-4)
lib/lp/archivepublisher/ftparchive.py (+15/-9)
lib/lp/bugs/model/bug.py (+25/-17)
lib/lp/bugs/model/bugtask.py (+13/-8)
lib/lp/bugs/model/bugwatch.py (+20/-24)
lib/lp/code/model/branch.py (+2/-2)
lib/lp/hardwaredb/model/hwdb.py (+17/-13)
lib/lp/registry/browser/distributionsourcepackage.py (+2/-1)
lib/lp/registry/doc/vocabularies.txt (+1/-1)
lib/lp/registry/model/distribution.py (+9/-8)
lib/lp/registry/model/distributionsourcepackage.py (+2/-4)
lib/lp/registry/model/person.py (+18/-33)
lib/lp/registry/model/pillar.py (+4/-1)
lib/lp/registry/model/projectgroup.py (+2/-3)
lib/lp/registry/model/sourcepackage.py (+2/-3)
lib/lp/registry/model/sourcepackagename.py (+3/-1)
lib/lp/registry/vocabularies.py (+15/-16)
lib/lp/scripts/garbo.py (+5/-5)
lib/lp/scripts/utilities/sanitizedb.py (+1/-1)
lib/lp/services/database/bulk.py (+1/-2)
lib/lp/services/worlddata/model/language.py (+5/-4)
lib/lp/soyuz/doc/gina.txt (+1/-1)
lib/lp/soyuz/doc/packageset.txt (+2/-2)
lib/lp/soyuz/model/archivepermission.py (+12/-13)
lib/lp/soyuz/model/binarypackagebuild.py (+2/-3)
lib/lp/soyuz/model/binarypackagename.py (+9/-5)
lib/lp/soyuz/model/distroarchseriesbinarypackage.py (+4/-10)
lib/lp/soyuz/model/packagediff.py (+5/-6)
lib/lp/soyuz/model/packageset.py (+17/-17)
lib/lp/soyuz/model/publishing.py (+22/-30)
lib/lp/soyuz/model/queue.py (+28/-40)
lib/lp/soyuz/scripts/initialise_distroseries.py (+3/-1)
lib/lp/translations/model/pofile.py (+1/-2)
lib/lp/translations/model/potemplate.py (+1/-2)
lib/lp/translations/model/translationimportqueue.py (+1/-2)
lib/lp/translations/scripts/migrate_variants.py (+9/-9)
setup.py (+1/-0)
versions.cfg (+1/-0)
- Jonathan Lange (community): Approve
- Christian Reis: Pending (release-critical) requested
- Diff: None lines
Changed in launchpad: | |
status: | In Progress → Fix Released |
Changed in storm: | |
status: | New → Invalid |
This form works:
>>> store.find(Person, Person. name.is_ in(['stub' ])).first( )
<Person at 0x8470490 stub (Stuart Bishop)>
This is a problem for us as the issue only recently became apparent in Launchpad after the Lucid upgrade with modern psycopg2.