- Auth() now implies BootAuth()
[plcapi.git] / PLC / PostgreSQL.py
index fa5f1cf..6286a1a 100644 (file)
@@ -5,12 +5,14 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: PostgreSQL.py,v 1.8 2006/10/30 16:37:49 mlhuang Exp $
+# $Id: PostgreSQL.py,v 1.10 2006/11/09 19:34:04 mlhuang Exp $
 #
 
 import psycopg2
 import psycopg2.extensions
 psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
+# UNICODEARRAY not exported yet
+psycopg2.extensions.register_type(psycopg2._psycopg.UNICODEARRAY)
 
 import pgdb
 from types import StringTypes, NoneType
@@ -178,7 +180,7 @@ class PostgreSQL:
         self.execute(query, params)
         rows = self.cursor.fetchall()
 
-        if hashref:
+        if hashref or key_field is not None:
             # Return each row as a dictionary keyed on field name
             # (like DBI selectrow_hashref()).
             labels = [column[0] for column in self.description]