1-- 2-- Hot Standby tests 3-- 4-- hs_standby_allowed.sql 5-- 6 7-- SELECT 8 9select count(*) as should_be_1 from hs1; 10 11select count(*) as should_be_2 from hs2; 12 13select count(*) as should_be_3 from hs3; 14 15COPY hs1 TO '/tmp/copy_test'; 16\! cat /tmp/copy_test 17 18-- Access sequence directly 19select min_value as sequence_min_value from hsseq; 20 21-- Transactions 22 23begin; 24select count(*) as should_be_1 from hs1; 25end; 26 27begin transaction read only; 28select count(*) as should_be_1 from hs1; 29end; 30 31begin transaction isolation level repeatable read; 32select count(*) as should_be_1 from hs1; 33select count(*) as should_be_1 from hs1; 34select count(*) as should_be_1 from hs1; 35commit; 36 37begin; 38select count(*) as should_be_1 from hs1; 39commit; 40 41begin; 42select count(*) as should_be_1 from hs1; 43abort; 44 45start transaction; 46select count(*) as should_be_1 from hs1; 47commit; 48 49begin; 50select count(*) as should_be_1 from hs1; 51rollback; 52 53begin; 54select count(*) as should_be_1 from hs1; 55savepoint s; 56select count(*) as should_be_2 from hs2; 57commit; 58 59begin; 60select count(*) as should_be_1 from hs1; 61savepoint s; 62select count(*) as should_be_2 from hs2; 63release savepoint s; 64select count(*) as should_be_2 from hs2; 65savepoint s; 66select count(*) as should_be_3 from hs3; 67rollback to savepoint s; 68select count(*) as should_be_2 from hs2; 69commit; 70 71-- SET parameters 72 73-- has no effect on read only transactions, but we can still set it 74set synchronous_commit = on; 75show synchronous_commit; 76reset synchronous_commit; 77 78discard temp; 79discard all; 80 81-- CURSOR commands 82 83BEGIN; 84 85DECLARE hsc CURSOR FOR select * from hs3; 86 87FETCH next from hsc; 88fetch first from hsc; 89fetch last from hsc; 90fetch 1 from hsc; 91 92CLOSE hsc; 93 94COMMIT; 95 96-- Prepared plans 97 98PREPARE hsp AS select count(*) from hs1; 99PREPARE hsp_noexec (integer) AS insert into hs1 values ($1); 100 101EXECUTE hsp; 102 103DEALLOCATE hsp; 104 105-- LOCK 106 107BEGIN; 108LOCK hs1 IN ACCESS SHARE MODE; 109LOCK hs1 IN ROW SHARE MODE; 110LOCK hs1 IN ROW EXCLUSIVE MODE; 111COMMIT; 112 113-- UNLISTEN 114UNLISTEN a; 115UNLISTEN *; 116 117-- LOAD 118-- should work, easier if there is no test for that... 119 120 121-- ALLOWED COMMANDS 122 123CHECKPOINT; 124 125discard all; 126