Cast dict values to string before quoting them

The SQL hstore function requires key and value of type text.
This commit is contained in:
Paul Eipper 2013-07-03 14:27:51 -03:00
parent 497247a528
commit 5159326448

View File

@ -644,7 +644,8 @@ class HstoreAdapter(object):
k = _ext.adapt(self.wrapped.keys()) k = _ext.adapt(self.wrapped.keys())
k.prepare(self.conn) k.prepare(self.conn)
v = _ext.adapt(self.wrapped.values()) values = [str(v) for v in self.wrapped.values()]
v = _ext.adapt(values)
v.prepare(self.conn) v.prepare(self.conn)
return b("hstore(") + k.getquoted() + b(", ") + v.getquoted() + b(")") return b("hstore(") + k.getquoted() + b(", ") + v.getquoted() + b(")")