Re: Question about transactions and pg_log - Mailing list pgsql-general

From Tom Lane
Subject Re: Question about transactions and pg_log
Date
Msg-id 18968.981420973@sss.pgh.pa.us
Whole thread Raw
In response to Question about transactions and pg_log  (Martijn van Oosterhout <martijn@ecomtel.com.au>)
List pgsql-general
Martijn van Oosterhout <martijn@ecomtel.com.au> writes:
> From what I currently understand, there is a pg_log file in the postgres
> data directory which indicates the state of transactions (committed or
> uncommitted).
> So from this I infer that transaction IDs are unique across a whole database
> installation?

Correct, and correct.

> The reason I ask is that I rename the directories within the data directory
> to rename a database. (I need to switch two databases reasonably quickly).
> If transaction IDs (and hence entries within pg_log) are not shared then the
> results would be catastrophic probably.

This strikes me as pretty darn dangerous in any case.  You could maybe
get away with it if you shutdown the postmaster first, but if you don't,
then you *will* get screwed by buffering considerations (open disk
buffers in shared memory are out of sync with the disk files after you
do the swap).

In 7.1 I believe you can rename a database just by updating its row in
pg_database.  You'd probably be far safer to run a 7.1 beta release and
do that, than to try to do it by renaming directories in previous
releases.

            regards, tom lane

pgsql-general by date:

Previous
From: Craig Orsinger
Date:
Subject: Re: Write to postgreSQL via ODBC?
Next
From: "Brett W. McCoy"
Date:
Subject: Re: How to install SQL 7.0