@@ -787,7 +787,7 @@ public static Table[] getTables(Connection conn){
787787 java .util .ArrayList <Table > tables = new java .util .ArrayList <>();
788788 try {
789789 DatabaseMetaData dbmd = conn .getConnection ().getMetaData ();
790- try (ResultSet rs = dbmd .getTables (null ,null ,null ,new String []{ "TABLE" } )){
790+ try (ResultSet rs = dbmd .getTables (null ,null ,null ,getTableFilter ( database ) )){
791791 while (rs .next ()) {
792792 tables .add (new Table (rs , dbmd ));
793793 }
@@ -827,7 +827,7 @@ public String[] getTableNames() throws SQLException {
827827 try (Connection conn = getConnection ()){
828828
829829 DatabaseMetaData dbmd = conn .getConnection ().getMetaData ();
830- try (ResultSet rs = dbmd .getTables (null ,null ,null ,new String []{ "TABLE" } )){
830+ try (ResultSet rs = dbmd .getTables (null ,null ,null ,getTableFilter ( this ) )){
831831 while (rs .next ()) {
832832 javaxt .utils .Record record = new javaxt .utils .Record ();
833833 record .set ("schema" , rs .getString ("TABLE_SCHEM" ));
@@ -853,6 +853,22 @@ public String[] getTableNames() throws SQLException {
853853 }
854854
855855
856+ //**************************************************************************
857+ //** getTableFilter
858+ //**************************************************************************
859+ /** Returns a filter used to generate a list of tables via DatabaseMetaData
860+ */
861+ private static String [] getTableFilter (Database database ){
862+ if (database !=null ){
863+ Driver driver = database .getDriver ();
864+ if (driver !=null && driver .equals ("PostgreSQL" )){
865+ return new String []{"TABLE" , "FOREIGN TABLE" };
866+ }
867+ }
868+ return new String []{"TABLE" };
869+ }
870+
871+
856872 //**************************************************************************
857873 //** getCatalogs
858874 //**************************************************************************
0 commit comments