Skip to content

Commit

Permalink
postgres provider: remove ctid limitation to 32bit
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Dec 22, 2011
1 parent 270655d commit 0715f70
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2044,25 +2044,11 @@ QString QgsPostgresProvider::getPrimaryKey()
.arg( quotedValue( mQuery ) );

Result ctidCheck = connectionRO->PQexec( sql );

if ( PQntuples( ctidCheck ) == 1 )
{
sql = QString( "SELECT max(substring(ctid::text from E'\\\\((\\\\d+),\\\\d+\\\\)')::integer) from %1" )
.arg( mQuery );

Result ctidCheck = connectionRO->PQexec( sql );
if ( PQntuples( ctidCheck ) == 1 )
{
int id = QString( PQgetvalue( ctidCheck, 0, 0 ) ).toInt();

if ( id < 0x10000 )
{
// fallback to ctid
primaryKey = "ctid";
primaryKeyType = "tid";
mIsDbPrimaryKey = true;
}
}
primaryKey = "ctid";
primaryKeyType = "tid";
mIsDbPrimaryKey = true;
}
}

Expand Down

0 comments on commit 0715f70

Please sign in to comment.