diff options
| author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-09-26 22:30:23 +0100 |
|---|---|---|
| committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-11-05 09:34:50 +0000 |
| commit | 70880dde7911c4f170f720d56851807c0672a1a3 (patch) | |
| tree | b8c17e2f438cac6659f28d95aa3ae86363b8e878 /lib/extras.py | |
| parent | 6d441b6e03717ebc830dfabe63bca1eb659e3590 (diff) | |
| download | psycopg2-70880dde7911c4f170f720d56851807c0672a1a3.tar.gz | |
Added special cases to store empty dicts.
Diffstat (limited to 'lib/extras.py')
| -rw-r--r-- | lib/extras.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/extras.py b/lib/extras.py index 7dc64e5..0af5868 100644 --- a/lib/extras.py +++ b/lib/extras.py @@ -487,6 +487,9 @@ class HstoreAdapter(object): def _getquoted_8(self): """Use the operators available in PG pre-9.0.""" + if not self.wrapped: + return "''::hstore" + adapt = _ext.adapt rv = [] for k, v in self.wrapped.iteritems(): @@ -509,6 +512,9 @@ class HstoreAdapter(object): def _getquoted_9(self): """Use the hstore(text[], text[]) function.""" + if not self.wrapped: + return "''::hstore" + k = _ext.adapt(self.wrapped.keys()) k.prepare(self.conn) v = _ext.adapt(self.wrapped.values()) |
