aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/expected/pagefuncs.out
blob: 38a72b01b3fd522fb54c2dfcc1a429d0f51f1aeb (plain)
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
--
-- Tests for functions related to relation pages
--
-- Restricted to superusers by default
CREATE ROLE regress_pgfunc_user;
SET ROLE regress_pgfunc_user;
SELECT pg_relation_check_pages('pg_class'); -- error
ERROR:  permission denied for function pg_relation_check_pages
SELECT pg_relation_check_pages('pg_class', 'main'); -- error
ERROR:  permission denied for function pg_relation_check_pages
RESET ROLE;
DROP ROLE regress_pgfunc_user;
-- NULL and simple sanity checks
SELECT pg_relation_check_pages(NULL); -- empty result
 pg_relation_check_pages 
-------------------------
(0 rows)

SELECT pg_relation_check_pages(NULL, NULL); -- empty result
 pg_relation_check_pages 
-------------------------
(0 rows)

SELECT pg_relation_check_pages('pg_class', 'invalid_fork'); -- error
ERROR:  invalid fork name
HINT:  Valid fork names are "main", "fsm", "vm", and "init".
-- Relation types that are supported
CREATE TABLE pgfunc_test_tab (id int);
CREATE INDEX pgfunc_test_ind ON pgfunc_test_tab(id);
INSERT INTO pgfunc_test_tab VALUES (generate_series(1,1000));
SELECT pg_relation_check_pages('pgfunc_test_tab');
 pg_relation_check_pages 
-------------------------
(0 rows)

SELECT pg_relation_check_pages('pgfunc_test_ind');
 pg_relation_check_pages 
-------------------------
(0 rows)

DROP TABLE pgfunc_test_tab;
CREATE MATERIALIZED VIEW pgfunc_test_matview AS SELECT 1;
SELECT pg_relation_check_pages('pgfunc_test_matview');
 pg_relation_check_pages 
-------------------------
(0 rows)

DROP MATERIALIZED VIEW pgfunc_test_matview;
CREATE SEQUENCE pgfunc_test_seq;
SELECT pg_relation_check_pages('pgfunc_test_seq');
 pg_relation_check_pages 
-------------------------
(0 rows)

DROP SEQUENCE pgfunc_test_seq;
-- pg_relation_check_pages() returns no results if passed relations that
-- do not support the operation, like relations without storage or temporary
-- relations.
CREATE TEMPORARY TABLE pgfunc_test_temp AS SELECT generate_series(1,10) AS a;
SELECT pg_relation_check_pages('pgfunc_test_temp');
 pg_relation_check_pages 
-------------------------
(0 rows)

DROP TABLE pgfunc_test_temp;
CREATE VIEW pgfunc_test_view AS SELECT 1;
SELECT pg_relation_check_pages('pgfunc_test_view');
 pg_relation_check_pages 
-------------------------
(0 rows)

DROP VIEW pgfunc_test_view;