This is backport of fixes from upstream pull request 560 and 569, excluding the testsuite fixes, namely commits: 3ff47daf68bf45694d5671eef1d9d32fb87f00d3 c9e5fc8bf53ead845f7b56c9cbe3c1058b636ca5 Fixes rhbz#1547424 diff --git a/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java b/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java index f1109f5..fa4d6c0 100644 --- a/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java +++ b/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java @@ -4094,6 +4094,15 @@ public abstract class AbstractJdbc2DatabaseMetaData + " END AS TYPE, " + " (i.keys).n AS ORDINAL_POSITION, " + " pg_catalog.pg_get_indexdef(ci.oid, (i.keys).n, false) AS COLUMN_NAME, " + + (connection.haveMinimumServerVersion("9.6") + ? " CASE am.amname " + + " WHEN 'btree' THEN CASE i.indoption[(i.keys).n - 1] & 1 " + + " WHEN 1 THEN 'D' " + + " ELSE 'A' " + + " END " + + " ELSE NULL " + + " END AS ASC_OR_DESC, " + : "" + " CASE am.amcanorder " + " WHEN true THEN CASE i.indoption[(i.keys).n - 1] & 1 " + " WHEN 1 THEN 'D' " @@ -4101,6 +4110,7 @@ public abstract class AbstractJdbc2DatabaseMetaData + " END " + " ELSE NULL " + " END AS ASC_OR_DESC, " + ) + " ci.reltuples AS CARDINALITY, " + " ci.relpages AS PAGES, " + " pg_catalog.pg_get_expr(i.indpred, i.indrelid) AS FILTER_CONDITION "