Skip to content

Commit 6a19c6d

Browse files
author
Dave Cramer
committed
added DISTINCT to the query to get cross reference. This is required when two columns in a table are both foreign keys to another table. From Peter Royal proyal@pace2020.com
1 parent 326b2f9 commit 6a19c6d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2966,7 +2966,7 @@ protected java.sql.ResultSet getImportedExportedKeys(String primaryCatalog, Stri
29662966
*/
29672967

29682968
if (connection.haveMinimumServerVersion("7.3")) {
2969-
select = "SELECT n1.nspname as pnspname,n2.nspname as fnspname, ";
2969+
select = "SELECT DISTINCT n1.nspname as pnspname,n2.nspname as fnspname, ";
29702970
from = " FROM pg_catalog.pg_namespace n1 "+
29712971
" JOIN pg_catalog.pg_class c1 ON (c1.relnamespace = n1.oid) "+
29722972
" JOIN pg_catalog.pg_index i ON (c1.oid=i.indrelid) "+
@@ -2985,7 +2985,7 @@ protected java.sql.ResultSet getImportedExportedKeys(String primaryCatalog, Stri
29852985
where += " AND n2.nspname = '"+escapeQuotes(foreignSchema)+"' ";
29862986
}
29872987
} else {
2988-
select = "SELECT NULL::text as pnspname, NULL::text as fnspname, ";
2988+
select = "SELECT DISTINCT NULL::text as pnspname, NULL::text as fnspname, ";
29892989
from = " FROM pg_class c1 "+
29902990
" JOIN pg_index i ON (c1.oid=i.indrelid) "+
29912991
" JOIN pg_class ic ON (i.indexrelid=ic.oid) "+

0 commit comments

Comments
 (0)