Skip to content
Permalink
Browse files

fix:getColumns should return columns for anything that looks like a t…

…able
  • Loading branch information
davecramer committed Oct 16, 2015
1 parent f1a5cc4 commit f9f55d6b15d185ae4ad387a578fec7e73389418f
Showing with 4 additions and 4 deletions.
  1. +4 −4 org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
@@ -2402,7 +2402,7 @@ protected ResultSet getSchemas(int jdbcVersion, String catalog, String schemaPat
" LEFT JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid) " +
" LEFT JOIN pg_catalog.pg_class dc ON (dc.oid=dsc.classoid AND dc.relname='pg_class') " +
" LEFT JOIN pg_catalog.pg_namespace dn ON (dc.relnamespace=dn.oid AND dn.nspname='pg_catalog') " +
" WHERE c.relkind='r' and a.attnum > 0 AND NOT a.attisdropped ";
" WHERE c.relkind in ('r','v','f','m') and a.attnum > 0 AND NOT a.attisdropped ";

if (schemaPattern != null && !"".equals(schemaPattern))
{
@@ -2427,7 +2427,7 @@ else if (connection.haveMinimumServerVersion(ServerVersion.v7_2))
" LEFT JOIN pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum) " +
" LEFT JOIN pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid) " +
" LEFT JOIN pg_class dc ON (dc.oid=dsc.classoid AND dc.relname='pg_class') " +
" WHERE c.relkind='r' and a.attnum > 0 ";
" WHERE c.relkind in ('r','v','f','m') and a.attnum > 0 ";
}
else if (connection.haveMinimumServerVersion(ServerVersion.v7_1))
{
@@ -2436,14 +2436,14 @@ else if (connection.haveMinimumServerVersion(ServerVersion.v7_1))
" JOIN pg_attribute a ON (a.attrelid=c.oid) " +
" LEFT JOIN pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum) " +
" LEFT JOIN pg_description dsc ON (a.oid=dsc.objoid) " +
" WHERE c.relkind='r' and a.attnum > 0 ";
" WHERE c.relkind in ('r','v','f','m') and a.attnum > 0 ";
}
else
{
// if < 7.1 then don't get defaults or descriptions.
sql = "SELECT NULL::text AS nspname,c.relname,a.attname,a.atttypid,a.attnotnull,a.atttypmod,a.attlen,a.attnum,NULL AS adsrc,NULL AS description,NULL AS typbasetype, 'b' AS typtype " +
" FROM pg_class c, pg_attribute a " +
" WHERE c.relkind='r' and a.attrelid=c.oid AND a.attnum > 0 ";
" WHERE c.relkind in ('r','v','f','m') and a.attrelid=c.oid AND a.attnum > 0 ";
}

if (!connection.haveMinimumServerVersion(ServerVersion.v7_3) && tableNamePattern != null && !"".equals(tableNamePattern))

0 comments on commit f9f55d6

Please sign in to comment.
You can’t perform that action at this time.