Open
Description
It would be useful to be able see if an index is partial and what the clause is.
For index_is_partial
, we can get that with:
SELECT x.indpred IS NOT NULL
FROM pg_catalog.pg_index x
JOIN pg_catalog.pg_class ct ON ct.oid = x.indrelid
JOIN pg_catalog.pg_class ci ON ci.oid = x.indexrelid
JOIN pg_catalog.pg_namespace n ON n.oid = ct.relnamespace
WHERE ct.relname = $table
AND ci.relname = $index
AND n.nspname = $schema;
For index_partial_clause_is
, we can get the string for the partial clause as:
SELECT pg_get_expr(x.indpred, x.indrelid)
FROM pg_catalog.pg_index x
JOIN pg_catalog.pg_class ct ON ct.oid = x.indrelid
JOIN pg_catalog.pg_class ci ON ci.oid = x.indexrelid
JOIN pg_catalog.pg_namespace n ON n.oid = ct.relnamespace
WHERE ct.relname = $table
AND ci.relname = $index
AND n.nspname = $schema;