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 authored and alexbruy committed Dec 23, 2011
1 parent c1eea90 commit 4783b7c
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -1220,25 +1220,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 4783b7c

Please sign in to comment.