Author: phd
Date: Sun May 13 09:48:41 2012
New Revision: 4524
Log:
Fixed a minor bug in PostgreSQL introspection [fixes issue 3471315].
Modified:
SQLObject/branches/1.2/docs/News.txt
SQLObject/branches/1.2/sqlobject/postgres/pgconnection.py
Modified: SQLObject/branches/1.2/docs/News.txt
==============================================================================
--- SQLObject/branches/1.2/docs/News.txt Fri Apr 20 08:35:41 2012 (r4523)
+++ SQLObject/branches/1.2/docs/News.txt Sun May 13 09:48:41 2012 (r4524)
@@ -7,6 +7,12 @@
.. _start:
+SQLObject 1.2.3
+===============
+
+* Fixed a minor bug in PostgreSQL introspection: VIEWs don't have
+ PRIMARY KEYs - use sqlmeta.idName as the key if there is no one.
+
SQLObject 1.2.2
===============
Modified: SQLObject/branches/1.2/sqlobject/postgres/pgconnection.py
==============================================================================
--- SQLObject/branches/1.2/sqlobject/postgres/pgconnection.py Fri Apr 20 08:35:41 2012 (r4523)
+++ SQLObject/branches/1.2/sqlobject/postgres/pgconnection.py Sun May 13 09:48:41 2012 (r4524)
@@ -246,6 +246,9 @@
assert match, "Unparseable contraint definition: %r" % indexDef
assert primaryKey is None, "Already found primary key (%r), then found: %r" % (primaryKey, indexDef)
primaryKey = match.group(1)
+ if primaryKey is None:
+ # VIEWs don't have PRIMARY KEYs - accept help from user
+ primaryKey = soClass.sqlmeta.idName
assert primaryKey, "No primary key found in table %r" % tableName
if primaryKey.startswith('"'):
assert primaryKey.endswith('"')
|