~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to src/test/regress/sql/hs_standby_allowed.sql

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

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