Skip to content
Permalink
Browse files

PG: Silence warning when discovering relations on query layers

  • Loading branch information
elpaso authored and nyalldawson committed Oct 8, 2020
1 parent 43a181b commit 06de70e702b2f190af94b9123deba151324c02a5
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/providers/postgres/qgspostgresprovider.cpp
@@ -4901,12 +4901,21 @@ QList<QgsVectorLayer *> QgsPostgresProvider::searchLayers( const QList<QgsVector
QList<QgsRelation> QgsPostgresProvider::discoverRelations( const QgsVectorLayer *self, const QList<QgsVectorLayer *> &layers ) const
{
QList<QgsRelation> result;

// Silently skip if this is a query layer or for some obscure reason there are no table and schema name
if ( mIsQuery || mTableName.isEmpty() || mSchemaName.isEmpty() )
{
return result;
}

// Skip less silently if layer is not valid
if ( !mValid )
{
QgsLogger::warning( "Error getting the foreign keys of " + mTableName + ": invalid connection" );
QgsLogger::warning( QStringLiteral( "Error discovering relations of %1: invalid layer" ).arg( mQuery ) );
return result;
}


QString sql(
"WITH foreign_keys AS "
" ( SELECT c.conname, "

0 comments on commit 06de70e

Please sign in to comment.
You can’t perform that action at this time.