File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -4901,12 +4901,21 @@ QList<QgsVectorLayer *> QgsPostgresProvider::searchLayers( const QList<QgsVector
4901
4901
QList<QgsRelation> QgsPostgresProvider::discoverRelations ( const QgsVectorLayer *self, const QList<QgsVectorLayer *> &layers ) const
4902
4902
{
4903
4903
QList<QgsRelation> result;
4904
+
4905
+ // Silently skip if this is a query layer or for some obscure reason there are no table and schema name
4906
+ if ( mIsQuery || mTableName .isEmpty () || mSchemaName .isEmpty () )
4907
+ {
4908
+ return result;
4909
+ }
4910
+
4911
+ // Skip less silently if layer is not valid
4904
4912
if ( !mValid )
4905
4913
{
4906
- QgsLogger::warning ( " Error getting the foreign keys of " + mTableName + " : invalid connection " );
4914
+ QgsLogger::warning ( QStringLiteral ( " Error discovering relations of %1 : invalid layer " ). arg ( mQuery ) );
4907
4915
return result;
4908
4916
}
4909
4917
4918
+
4910
4919
QString sql (
4911
4920
" WITH foreign_keys AS "
4912
4921
" ( SELECT c.conname, "
You can’t perform that action at this time.
0 commit comments