1--
2-- Hot Standby tests
3--
4-- hs_standby_disallowed.sql
5--
6SET transaction_read_only = off;
7ERROR:  cannot set transaction read-write mode during recovery
8begin transaction read write;
9ERROR:  cannot set transaction read-write mode during recovery
10commit;
11WARNING:  there is no transaction in progress
12-- SELECT
13select * from hs1 FOR SHARE;
14ERROR:  cannot execute SELECT FOR SHARE in a read-only transaction
15select * from hs1 FOR UPDATE;
16ERROR:  cannot execute SELECT FOR UPDATE in a read-only transaction
17-- DML
18BEGIN;
19insert into hs1 values (37);
20ERROR:  cannot execute INSERT in a read-only transaction
21ROLLBACK;
22BEGIN;
23delete from hs1 where col1 = 1;
24ERROR:  cannot execute DELETE in a read-only transaction
25ROLLBACK;
26BEGIN;
27update hs1 set col1 = NULL where col1 > 0;
28ERROR:  cannot execute UPDATE in a read-only transaction
29ROLLBACK;
30BEGIN;
31truncate hs3;
32ERROR:  cannot execute TRUNCATE TABLE in a read-only transaction
33ROLLBACK;
34-- DDL
35create temporary table hstemp1 (col1 integer);
36ERROR:  cannot execute CREATE TABLE in a read-only transaction
37BEGIN;
38drop table hs2;
39ERROR:  cannot execute DROP TABLE in a read-only transaction
40ROLLBACK;
41BEGIN;
42create table hs4 (col1 integer);
43ERROR:  cannot execute CREATE TABLE in a read-only transaction
44ROLLBACK;
45-- Sequences
46SELECT nextval('hsseq');
47ERROR:  cannot execute nextval() in a read-only transaction
48-- Two-phase commit transaction stuff
49BEGIN;
50SELECT count(*) FROM hs1;
51 count
52-------
53     1
54(1 row)
55
56PREPARE TRANSACTION 'foobar';
57ERROR:  cannot execute PREPARE TRANSACTION during recovery
58ROLLBACK;
59BEGIN;
60SELECT count(*) FROM hs1;
61 count
62-------
63     1
64(1 row)
65
66COMMIT PREPARED 'foobar';
67ERROR:  COMMIT PREPARED cannot run inside a transaction block
68ROLLBACK;
69BEGIN;
70SELECT count(*) FROM hs1;
71 count
72-------
73     1
74(1 row)
75
76PREPARE TRANSACTION 'foobar';
77ERROR:  cannot execute PREPARE TRANSACTION during recovery
78ROLLBACK PREPARED 'foobar';
79ERROR:  current transaction is aborted, commands ignored until end of transaction block
80ROLLBACK;
81BEGIN;
82SELECT count(*) FROM hs1;
83 count
84-------
85     1
86(1 row)
87
88ROLLBACK PREPARED 'foobar';
89ERROR:  ROLLBACK PREPARED cannot run inside a transaction block
90ROLLBACK;
91-- Locks
92BEGIN;
93LOCK hs1;
94ERROR:  cannot execute LOCK TABLE during recovery
95COMMIT;
96BEGIN;
97LOCK hs1 IN SHARE UPDATE EXCLUSIVE MODE;
98ERROR:  cannot execute LOCK TABLE during recovery
99COMMIT;
100BEGIN;
101LOCK hs1 IN SHARE MODE;
102ERROR:  cannot execute LOCK TABLE during recovery
103COMMIT;
104BEGIN;
105LOCK hs1 IN SHARE ROW EXCLUSIVE MODE;
106ERROR:  cannot execute LOCK TABLE during recovery
107COMMIT;
108BEGIN;
109LOCK hs1 IN EXCLUSIVE MODE;
110ERROR:  cannot execute LOCK TABLE during recovery
111COMMIT;
112BEGIN;
113LOCK hs1 IN ACCESS EXCLUSIVE MODE;
114ERROR:  cannot execute LOCK TABLE during recovery
115COMMIT;
116-- Listen
117listen a;
118ERROR:  cannot execute LISTEN during recovery
119notify a;
120ERROR:  cannot execute NOTIFY during recovery
121-- disallowed commands
122ANALYZE hs1;
123ERROR:  cannot execute ANALYZE during recovery
124VACUUM hs2;
125ERROR:  cannot execute VACUUM during recovery
126CLUSTER hs2 using hs1_pkey;
127ERROR:  cannot execute CLUSTER during recovery
128REINDEX TABLE hs2;
129ERROR:  cannot execute REINDEX during recovery
130REVOKE SELECT ON hs1 FROM PUBLIC;
131ERROR:  cannot execute REVOKE in a read-only transaction
132GRANT SELECT ON hs1 TO PUBLIC;
133ERROR:  cannot execute GRANT in a read-only transaction
134