Consistently use "superuser" instead of "super user"
[pgsql.git] / contrib / pg_freespacemap / pg_freespacemap--1.1.sql
blobe1b8242268b0645fd21124245871898112d5e312
1 /* contrib/pg_freespacemap/pg_freespacemap--1.1.sql */
3 -- complain if script is sourced in psql, rather than via CREATE EXTENSION
4 \echo Use "CREATE EXTENSION pg_freespacemap" to load this file. \quit
6 -- Register the C function.
7 CREATE FUNCTION pg_freespace(regclass, bigint)
8 RETURNS int2
9 AS 'MODULE_PATHNAME', 'pg_freespace'
10 LANGUAGE C STRICT PARALLEL SAFE;
12 -- pg_freespace shows the recorded space avail at each block in a relation
13 CREATE FUNCTION
14   pg_freespace(rel regclass, blkno OUT bigint, avail OUT int2)
15 RETURNS SETOF RECORD
16 AS $$
17   SELECT blkno, pg_freespace($1, blkno) AS avail
18   FROM generate_series(0, pg_relation_size($1) / current_setting('block_size')::bigint - 1) AS blkno;
20 LANGUAGE SQL PARALLEL SAFE;
23 -- Don't want these to be available to public.
24 REVOKE ALL ON FUNCTION pg_freespace(regclass, bigint) FROM PUBLIC;
25 REVOKE ALL ON FUNCTION pg_freespace(regclass) FROM PUBLIC;