OSDN Git Service

Clean up handling of XactReadOnly and RecoveryInProgress checks.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 20 Feb 2010 21:24:02 +0000 (21:24 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 20 Feb 2010 21:24:02 +0000 (21:24 +0000)
commit05d8a561ff85db1545f5768fe8d8dc9d99ad2ef7
treeba96f990b49f0831e04e44f5771e54fd12c74076
parentfada4204b97ac473d64286f2a78af2587627bf49
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.
12 files changed:
src/backend/access/transam/varsup.c
src/backend/access/transam/xact.c
src/backend/catalog/namespace.c
src/backend/commands/async.c
src/backend/commands/copy.c
src/backend/commands/lockcmds.c
src/backend/commands/sequence.c
src/backend/executor/execMain.c
src/backend/tcop/utility.c
src/backend/utils/adt/txid.c
src/include/miscadmin.h
src/test/regress/expected/transactions.out