-- 
-- Hot Standby tests
--
-- standby_disallowed.sql
--

SET default_transaction_read_only = on;

begin transaction read write;
commit;

-- SELECT

select * from hs1 FOR SHARE;

select * from hs1 FOR UPDATE;

-- DML

insert into hs1 values (37, 'a');
delete from hs1 where col1 = 1;
update hs1 set col2 = NULL where col1 > 0;
truncate hs3;

-- DDL

create temporary table hstemp1 (col1 integer);
drop table hs2;

-- Sequences

SELECT nextval('hsseq');

-- Two-phase commit transaction stuff

BEGIN;
SELECT count(*) FROM hs1;
PREPARE TRANSACTION 'foobar';
COMMIT PREPARED 'foobar';

BEGIN;
SELECT count(*) FROM hs1;
PREPARE TRANSACTION 'foobar';
ROLLBACK PREPARED 'foobar';

ROLLBACK;

-- Listen
listen a;

notify a;

unlisten a;

unlisten *;

-- disallowed commands

ANALYZE hs1;

VACUUM hs2;

CLUSTER hs2 using hs1_pkey;

REINDEX TABLE hs2;

CHECKPOINT;

GRANT SELECT ON hs1 TO PUBLIC;

REVOKE SELECT ON hs1 FROM PUBLIC;
