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 Jan 27, 2012
1 parent 6af166f commit ca1a7df
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/providers/postgres/qgspostgresprovider.cpp
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 ca1a7df

Please sign in to comment.