diff --git a/presto-postgresql/src/main/java/com/facebook/presto/plugin/postgresql/PostgreSqlClient.java b/presto-postgresql/src/main/java/com/facebook/presto/plugin/postgresql/PostgreSqlClient.java index 8a74d8f49dee..d3be1a8ad84b 100644 --- a/presto-postgresql/src/main/java/com/facebook/presto/plugin/postgresql/PostgreSqlClient.java +++ b/presto-postgresql/src/main/java/com/facebook/presto/plugin/postgresql/PostgreSqlClient.java @@ -29,6 +29,8 @@ import com.google.common.base.Throwables; import io.airlift.slice.Slice; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; import java.sql.Types; import org.postgresql.Driver; @@ -117,4 +119,17 @@ protected Type toPrestoType(int jdbcType) return VARBINARY; } } + + @Override + protected ResultSet getTables(Connection connection, String schemaName, String tableName) + throws SQLException + { + DatabaseMetaData metadata = connection.getMetaData(); + String escape = metadata.getSearchStringEscape(); + return metadata.getTables( + connection.getCatalog(), + escapeNamePattern(schemaName, escape), + escapeNamePattern(tableName, escape), + new String[] {"TABLE", "VIEW"}); + } }