[QGIS Commit] r13781 - trunk/qgis/src/providers/postgres

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Jun 22 12:22:06 EDT 2010


Author: jef
Date: 2010-06-22 16:22:06 +0000 (Tue, 22 Jun 2010)
New Revision: 13781

Modified:
   trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
Log:
allow adding features to postgres layers with oid

Modified: trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2010-06-22 13:18:48 UTC (rev 13780)
+++ trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2010-06-22 16:22:06 UTC (rev 13781)
@@ -1142,7 +1142,7 @@
           // oid isn't indexed (and that they may want to add a
           // primary key to the table)
           primaryKey = "oid";
-          primaryKeyType = "int4";
+          primaryKeyType = "oid";
           mIsDbPrimaryKey = true;
         }
         else
@@ -1308,7 +1308,7 @@
         if ( PQntuples( oidCheck ) != 0 )
         {
           primaryKey = "oid";
-          primaryKeyType = "int4";
+          primaryKeyType = "oid";
         }
         else
         {
@@ -2240,7 +2240,7 @@
                               .arg( srid );
 
     int offset;
-    if ( primaryKeyType != "tid" )
+    if ( primaryKeyType != "tid" && primaryKeyType != "oid" )
     {
       insert += "," + quotedIdentifier( primaryKey );
       values += ",$2";
@@ -2346,7 +2346,7 @@
       QStringList params;
       params << geomParam;
 
-      if ( primaryKeyType != "tid" )
+      if ( primaryKeyType != "tid" && primaryKeyType != "oid" )
       {
         int id = paramValue( primaryKeyDefault(), primaryKeyDefault() ).toInt();
         params << QString::number( id );



More information about the QGIS-commit mailing list