Skip to content

Commit 383545c

Browse files
author
jef
committed
allow adding features to postgres layers with oid
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13781 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 0c0c86d commit 383545c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ QString QgsPostgresProvider::getPrimaryKey()
11421142
// oid isn't indexed (and that they may want to add a
11431143
// primary key to the table)
11441144
primaryKey = "oid";
1145-
primaryKeyType = "int4";
1145+
primaryKeyType = "oid";
11461146
mIsDbPrimaryKey = true;
11471147
}
11481148
else
@@ -1308,7 +1308,7 @@ QString QgsPostgresProvider::getPrimaryKey()
13081308
if ( PQntuples( oidCheck ) != 0 )
13091309
{
13101310
primaryKey = "oid";
1311-
primaryKeyType = "int4";
1311+
primaryKeyType = "oid";
13121312
}
13131313
else
13141314
{
@@ -2240,7 +2240,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
22402240
.arg( srid );
22412241

22422242
int offset;
2243-
if ( primaryKeyType != "tid" )
2243+
if ( primaryKeyType != "tid" && primaryKeyType != "oid" )
22442244
{
22452245
insert += "," + quotedIdentifier( primaryKey );
22462246
values += ",$2";
@@ -2346,7 +2346,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
23462346
QStringList params;
23472347
params << geomParam;
23482348

2349-
if ( primaryKeyType != "tid" )
2349+
if ( primaryKeyType != "tid" && primaryKeyType != "oid" )
23502350
{
23512351
int id = paramValue( primaryKeyDefault(), primaryKeyDefault() ).toInt();
23522352
params << QString::number( id );

0 commit comments

Comments
 (0)