Skip to content

Commit

Permalink
Avoid having duplicated relations in the discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Valsecchi authored and m-kuhn committed Nov 7, 2016
1 parent 0ca9eb0 commit 8e7ae8f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4007,6 +4007,7 @@ QList<QgsRelation> QgsPostgresProvider::discoverRelations( const QgsVectorLayer*
"ON KCU2.CONSTRAINT_CATALOG = RC.UNIQUE_CONSTRAINT_CATALOG AND KCU2.CONSTRAINT_SCHEMA = RC.UNIQUE_CONSTRAINT_SCHEMA AND KCU2.CONSTRAINT_NAME = RC.UNIQUE_CONSTRAINT_NAME "
"AND KCU2.ORDINAL_POSITION = KCU1.ORDINAL_POSITION "
"WHERE KCU1.CONSTRAINT_SCHEMA=" + QgsPostgresConn::quotedValue( mSchemaName ) + " AND KCU1.TABLE_NAME=" + QgsPostgresConn::quotedValue( mTableName ) +
"GROUP BY RC.CONSTRAINT_NAME, KCU1.COLUMN_NAME, KCU2.CONSTRAINT_SCHEMA, KCU2.TABLE_NAME, KCU2.COLUMN_NAME, KCU1.ORDINAL_POSITION " +
"ORDER BY KCU1.ORDINAL_POSITION"
);
QgsPostgresResult sqlResult( connectionRO()->PQexec( sql ) );
Expand Down

0 comments on commit 8e7ae8f

Please sign in to comment.