File: pg_visibility--1.1.sql

package info (click to toggle)
postgresql-13 13.16-0%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 153,784 kB
  • sloc: ansic: 876,381; sql: 94,589; yacc: 33,895; xml: 31,046; perl: 30,722; lex: 8,840; makefile: 6,072; sh: 4,877; cpp: 746; python: 158; asm: 65; sed: 16
file content (75 lines) | stat: -rw-r--r-- 2,825 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* contrib/pg_visibility/pg_visibility--1.1.sql */

-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION pg_visibility" to load this file. \quit

-- Show visibility map information.
CREATE FUNCTION pg_visibility_map(regclass, blkno bigint,
								  all_visible OUT boolean,
								  all_frozen OUT boolean)
RETURNS record
AS 'MODULE_PATHNAME', 'pg_visibility_map'
LANGUAGE C STRICT;

-- Show visibility map and page-level visibility information.
CREATE FUNCTION pg_visibility(regclass, blkno bigint,
							  all_visible OUT boolean,
							  all_frozen OUT boolean,
							  pd_all_visible OUT boolean)
RETURNS record
AS 'MODULE_PATHNAME', 'pg_visibility'
LANGUAGE C STRICT;

-- Show visibility map information for each block in a relation.
CREATE FUNCTION pg_visibility_map(regclass, blkno OUT bigint,
								  all_visible OUT boolean,
								  all_frozen OUT boolean)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pg_visibility_map_rel'
LANGUAGE C STRICT;

-- Show visibility map and page-level visibility information for each block.
CREATE FUNCTION pg_visibility(regclass, blkno OUT bigint,
							  all_visible OUT boolean,
							  all_frozen OUT boolean,
							  pd_all_visible OUT boolean)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pg_visibility_rel'
LANGUAGE C STRICT;

-- Show summary of visibility map bits for a relation.
CREATE FUNCTION pg_visibility_map_summary(regclass,
    OUT all_visible bigint, OUT all_frozen bigint)
RETURNS record
AS 'MODULE_PATHNAME', 'pg_visibility_map_summary'
LANGUAGE C STRICT;

-- Show tupleids of non-frozen tuples if any in all_frozen pages
-- for a relation.
CREATE FUNCTION pg_check_frozen(regclass, t_ctid OUT tid)
RETURNS SETOF tid
AS 'MODULE_PATHNAME', 'pg_check_frozen'
LANGUAGE C STRICT;

-- Show tupleids of dead tuples if any in all_visible pages for a relation.
CREATE FUNCTION pg_check_visible(regclass, t_ctid OUT tid)
RETURNS SETOF tid
AS 'MODULE_PATHNAME', 'pg_check_visible'
LANGUAGE C STRICT;

-- Truncate the visibility map fork.
CREATE FUNCTION pg_truncate_visibility_map(regclass)
RETURNS void
AS 'MODULE_PATHNAME', 'pg_truncate_visibility_map'
LANGUAGE C STRICT
PARALLEL UNSAFE;  -- let's not make this any more dangerous

-- Don't want these to be available to public.
REVOKE ALL ON FUNCTION pg_visibility_map(regclass, bigint) FROM PUBLIC;
REVOKE ALL ON FUNCTION pg_visibility(regclass, bigint) FROM PUBLIC;
REVOKE ALL ON FUNCTION pg_visibility_map(regclass) FROM PUBLIC;
REVOKE ALL ON FUNCTION pg_visibility(regclass) FROM PUBLIC;
REVOKE ALL ON FUNCTION pg_visibility_map_summary(regclass) FROM PUBLIC;
REVOKE ALL ON FUNCTION pg_check_frozen(regclass) FROM PUBLIC;
REVOKE ALL ON FUNCTION pg_check_visible(regclass) FROM PUBLIC;
REVOKE ALL ON FUNCTION pg_truncate_visibility_map(regclass) FROM PUBLIC;