1--
2-- Hot Standby tests
3--
4-- hs_standby_functions.sql
5--
6-- should fail
7select txid_current();
8ERROR:  cannot execute txid_current() during recovery
9select length(txid_current_snapshot()::text) >= 4;
10 ?column?
11----------
12 t
13(1 row)
14
15select pg_start_backup('should fail');
16ERROR:  recovery is in progress
17HINT:  WAL control functions cannot be executed during recovery.
18select pg_switch_wal();
19ERROR:  recovery is in progress
20HINT:  WAL control functions cannot be executed during recovery.
21select pg_stop_backup();
22ERROR:  recovery is in progress
23HINT:  WAL control functions cannot be executed during recovery.
24-- should return no rows
25select * from pg_prepared_xacts;
26 transaction | gid | prepared | owner | database
27-------------+-----+----------+-------+----------
28(0 rows)
29
30-- just the startup process
31select locktype, virtualxid, virtualtransaction, mode, granted
32from pg_locks where virtualxid = '1/1';
33  locktype  | virtualxid | virtualtransaction |     mode      | granted
34------------+------------+--------------------+---------------+---------
35 virtualxid | 1/1        | 1/0                | ExclusiveLock | t
36(1 row)
37
38-- suicide is painless
39select pg_cancel_backend(pg_backend_pid());
40ERROR:  canceling statement due to user request
41