3 -- Adjust this setting to control where the objects get created.
4 SET search_path
= public;
7 -- Register the C function.
8 CREATE OR REPLACE FUNCTION pg_freespace(regclass
, bigint)
10 AS 'MODULE_PATHNAME', 'pg_freespace'
13 -- pg_freespace shows the recorded space avail at each block in a relation
14 CREATE OR REPLACE FUNCTION
15 pg_freespace(rel regclass
, blkno
OUT bigint, avail
OUT int2
)
18 SELECT blkno
, pg_freespace($
1, blkno
) AS avail
19 FROM generate_series(0, pg_relation_size($
1) / current_setting('block_size')::bigint - 1) AS blkno
;
24 -- Don't want these to be available to public.
25 REVOKE ALL ON FUNCTION pg_freespace(regclass
, bigint) FROM PUBLIC;
26 REVOKE ALL ON FUNCTION pg_freespace(regclass
) FROM PUBLIC;