[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] Corrupt database
From: |
Karsten Hilbert |
Subject: |
Re: [Gnumed-devel] Corrupt database |
Date: |
Sat, 1 Jun 2013 10:53:03 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sat, Jun 01, 2013 at 08:44:02AM +0200, Jerzy Luszawski wrote:
> > > 2. How to drop a readonly table
> >
> > set default_transaction_read_only to off;
> > drop table ...;
>
> If I understand this option correctly, using it is insecure, as any
> transaction (may be from all over the world) started before resetting
> it to ON becomes read-write.
*started before* ? I can't believe that to be true.
To my knowledge it affect transactions started *after*
issuing this WITHIN THIS CONNECTION ONLY.
Maybe I am wrong ?
default_transaction_read_only (boolean)
A read-only SQL transaction cannot alter non-temporary
tables. This parameter controls the default read-only
status of each new transaction. The default is off (
read/write).
[...] of each NEW transaction [...]
Now, when a new connection is made it will read several
sources to determine the state: postgresql.conf, database
configuration (which is what GNUmed sets at bootstrap and
checks at startup), user configuration. So, new transactions
very likely have it to ON (unless a user stores a different
default for themselves).
All that does not say anything about NEW transactiosn in
EXISTING connections but I am really hard-pressed to believe
that that should be the case because PostgreSQL is coded
extremely conservative.
> That's why I use
>
> set session characteristics as transaction READ WRITE ;
Nonetheless, this is the safer option, indeed !
(Because it applies to the one transaction one runs it in ONLY.)
Thanks for pointing that out.
Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346