aboutsummaryrefslogtreecommitdiff
path: root/contrib/pgstattuple/pgstatapprox.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2020-06-30 00:29:35 +0200
committerPeter Eisentraut <peter@eisentraut.org>2020-06-30 00:56:43 +0200
commitee0202d552791f14bc407ce299628ce8d50eebe3 (patch)
tree5abce35cf66587e328e71169d9db1b2783924242 /contrib/pgstattuple/pgstatapprox.c
parentea57e531b9487e042131ca1151a3ef5d655f40ec (diff)
downloadpostgresql-ee0202d552791f14bc407ce299628ce8d50eebe3.tar.gz
postgresql-ee0202d552791f14bc407ce299628ce8d50eebe3.zip
pgstattuple: Have pgstattuple_approx accept TOAST tables
TOAST tables have a visibility map and a free space map, so they can be supported by pgstattuple_approx just fine. Add test cases to show how various pgstattuple functions accept TOAST tables. Also add similar tests to pg_visibility, which already accepted TOAST tables correctly but had no test coverage for them. Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at> Discussion: https://www.postgresql.org/message-id/flat/27c4496a-02b9-dc87-8f6f-bddbef54e0fe@2ndquadrant.com
Diffstat (limited to 'contrib/pgstattuple/pgstatapprox.c')
-rw-r--r--contrib/pgstattuple/pgstatapprox.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/pgstattuple/pgstatapprox.c b/contrib/pgstattuple/pgstatapprox.c
index 96d837485fa..dbc0fa11f61 100644
--- a/contrib/pgstattuple/pgstatapprox.c
+++ b/contrib/pgstattuple/pgstatapprox.c
@@ -278,15 +278,15 @@ pgstattuple_approx_internal(Oid relid, FunctionCallInfo fcinfo)
errmsg("cannot access temporary tables of other sessions")));
/*
- * We support only ordinary relations and materialised views, because we
- * depend on the visibility map and free space map for our estimates about
- * unscanned pages.
+ * We support only relation kinds with a visibility map and a free space
+ * map.
*/
if (!(rel->rd_rel->relkind == RELKIND_RELATION ||
- rel->rd_rel->relkind == RELKIND_MATVIEW))
+ rel->rd_rel->relkind == RELKIND_MATVIEW ||
+ rel->rd_rel->relkind == RELKIND_TOASTVALUE))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("\"%s\" is not a table or materialized view",
+ errmsg("\"%s\" is not a table, materialized view, or TOAST table",
RelationGetRelationName(rel))));
if (rel->rd_rel->relam != HEAP_TABLE_AM_OID)