Skip to content

Commit 650d97b

Browse files
author
brushtyler
committedDec 15, 2010
use both schema and table name retrieving oid, to fix #3329
fixed endian deduction corrupted in r13340 git-svn-id: http://svn.osgeo.org/qgis/trunk@14919 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent dbb5a1c commit 650d97b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2957,8 +2957,10 @@ bool QgsPostgresProvider::deduceEndian()
29572957
if ( i < PQnfields( res ) )
29582958
{
29592959
// get the table name
2960-
res = connectionRO->PQexec( QString( "SELECT relname FROM pg_class WHERE oid=%1" ).arg( oidValue ) );
2961-
query = QString::fromUtf8( PQgetvalue( res, 0, 0 ) );
2960+
res = connectionRO->PQexec( QString( "SELECT pg_namespace.nspname,pg_class.relname FROM pg_class,pg_namespace WHERE pg_class.relnamespace=pg_namespace.oid AND pg_class.oid=%1" ).arg( oidValue ) );
2961+
QString schemaName = QString::fromUtf8( PQgetvalue( res, 0, 0 ) );
2962+
QString tableName = QString::fromUtf8( PQgetvalue( res, 0, 1 ) );
2963+
query = quotedIdentifier( schemaName ) + "." + quotedIdentifier( tableName );
29622964
}
29632965
else
29642966
{
@@ -2972,6 +2974,7 @@ bool QgsPostgresProvider::deduceEndian()
29722974
Result oidResult = connectionRO->PQexec( firstOid );
29732975
// get the int value from a "normal" select
29742976
oidValue = QString::fromUtf8( PQgetvalue( oidResult, 0, 0 ) );
2977+
query = mQuery;
29752978
}
29762979

29772980
QgsDebugMsg( "Creating binary cursor" );

0 commit comments

Comments
 (0)
Please sign in to comment.