aboutsummaryrefslogtreecommitdiff
path: root/contrib/pgstattuple/pgstattuple.sql.in
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/pgstattuple/pgstattuple.sql.in')
-rw-r--r--contrib/pgstattuple/pgstattuple.sql.in20
1 files changed, 16 insertions, 4 deletions
diff --git a/contrib/pgstattuple/pgstattuple.sql.in b/contrib/pgstattuple/pgstattuple.sql.in
index b49a13483f7..7c661a8ee3c 100644
--- a/contrib/pgstattuple/pgstattuple.sql.in
+++ b/contrib/pgstattuple/pgstattuple.sql.in
@@ -1,4 +1,16 @@
-DROP FUNCTION pgstattuple(text);
-CREATE FUNCTION pgstattuple(text) RETURNS float8
-AS 'MODULE_PATHNAME', 'pgstattuple'
-LANGUAGE 'c' WITH (isstrict);
+DROP VIEW pgstattuple_view CASCADE;
+CREATE VIEW pgstattuple_view AS
+ SELECT
+ 0::BIGINT AS table_len, -- physical table length in bytes
+ 0::BIGINT AS tuple_count, -- number of live tuples
+ 0::BIGINT AS tuple_len, -- total tuples length in bytes
+ 0.0::FLOAT AS tuple_percent, -- live tuples in %
+ 0::BIGINT AS dead_tuple_count, -- number of dead tuples
+ 0::BIGINT AS dead_tuple_len, -- total dead tuples length in bytes
+ 0.0::FLOAT AS dead_tuple_percent, -- dead tuples in %
+ 0::BIGINT AS free_space, -- free space in bytes
+ 0.0::FLOAT AS free_percent; -- free space in %
+
+CREATE OR REPLACE FUNCTION pgstattuple(text) RETURNS SETOF pgstattuple_view
+ AS 'MODULE_PATHNAME', 'pgstattuple'
+ LANGUAGE 'c' WITH (isstrict);