pgsql: Clean up handling of XactReadOnly and RecoveryInProgress checks. - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Clean up handling of XactReadOnly and RecoveryInProgress checks.
Date
Msg-id 20100220212402.8FE0F7541C5@cvs.postgresql.org
Whole thread Raw
List pgsql-committers
Log Message:
-----------
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.

Modified Files:
--------------
    pgsql/src/backend/access/transam:
        varsup.c (r1.89 -> r1.90)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/varsup.c?r1=1.89&r2=1.90)
        xact.c (r1.287 -> r1.288)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/xact.c?r1=1.287&r2=1.288)
    pgsql/src/backend/catalog:
        namespace.c (r1.123 -> r1.124)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/namespace.c?r1=1.123&r2=1.124)
    pgsql/src/backend/commands:
        async.c (r1.153 -> r1.154)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/async.c?r1=1.153&r2=1.154)
        copy.c (r1.324 -> r1.325)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/copy.c?r1=1.324&r2=1.325)
        lockcmds.c (r1.27 -> r1.28)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/lockcmds.c?r1=1.27&r2=1.28)
        sequence.c (r1.167 -> r1.168)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/sequence.c?r1=1.167&r2=1.168)
    pgsql/src/backend/executor:
        execMain.c (r1.346 -> r1.347)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/execMain.c?r1=1.346&r2=1.347)
    pgsql/src/backend/tcop:
        utility.c (r1.333 -> r1.334)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/tcop/utility.c?r1=1.333&r2=1.334)
    pgsql/src/backend/utils/adt:
        txid.c (r1.11 -> r1.12)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/txid.c?r1=1.11&r2=1.12)
    pgsql/src/include:
        miscadmin.h (r1.218 -> r1.219)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/miscadmin.h?r1=1.218&r2=1.219)
    pgsql/src/test/regress/expected:
        transactions.out (r1.19 -> r1.20)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/transactions.out?r1=1.19&r2=1.20)

pgsql-committers by date:

Previous
From: momjian@postgresql.org (Bruce Momjian)
Date:
Subject: pgsql: Make 'include_realm' ordering consistent in the docs, to match
Next
From: adunstan@postgresql.org (Andrew Dunstan)
Date:
Subject: pgsql: Adjust sample auto-explain output to reflect query text