summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane2010-02-20 21:24:02 +0000
committerTom Lane2010-02-20 21:24:02 +0000
commit05d8a561ff85db1545f5768fe8d8dc9d99ad2ef7 (patch)
treeba96f990b49f0831e04e44f5771e54fd12c74076 /src/test
parentfada4204b97ac473d64286f2a78af2587627bf49 (diff)
Clean up handling of XactReadOnly and RecoveryInProgress checks.
Add some checks that seem logically necessary, in particular let's make real sure that HS slave sessions cannot create temp tables. (If they did they would think that temp tables belonging to the master's session with the same BackendId were theirs. We *must* not allow myTempNamespace to become set in a slave session.) Change setval() and nextval() so that they are only allowed on temp sequences in a read-only transaction. This seems consistent with what we allow for table modifications in read-only transactions. Since an HS slave can't have a temp sequence, this also provides a nicer cure for the setval PANIC reported by Erik Rijkers. Make the error messages more uniform, and have them mention the specific command being complained of. This seems worth the trifling amount of extra code, since people are likely to see such messages a lot more than before.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/transactions.out8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/regress/expected/transactions.out b/src/test/regress/expected/transactions.out
index fc98f0163a0..c4f8965fd1e 100644
--- a/src/test/regress/expected/transactions.out
+++ b/src/test/regress/expected/transactions.out
@@ -45,9 +45,9 @@ CREATE TABLE writetest (a int);
CREATE TEMPORARY TABLE temptest (a int);
SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY;
DROP TABLE writetest; -- fail
-ERROR: transaction is read-only
+ERROR: cannot execute DROP TABLE in a read-only transaction
INSERT INTO writetest VALUES (1); -- fail
-ERROR: transaction is read-only
+ERROR: cannot execute INSERT in a read-only transaction
SELECT * FROM writetest; -- ok
a
---
@@ -57,14 +57,14 @@ DELETE FROM temptest; -- ok
UPDATE temptest SET a = 0 FROM writetest WHERE temptest.a = 1 AND writetest.a = temptest.a; -- ok
PREPARE test AS UPDATE writetest SET a = 0; -- ok
EXECUTE test; -- fail
-ERROR: transaction is read-only
+ERROR: cannot execute UPDATE in a read-only transaction
SELECT * FROM writetest, temptest; -- ok
a | a
---+---
(0 rows)
CREATE TABLE test AS SELECT * FROM writetest; -- fail
-ERROR: transaction is read-only
+ERROR: cannot execute SELECT INTO in a read-only transaction
START TRANSACTION READ WRITE;
DROP TABLE writetest; -- ok
COMMIT;