On Sun, Jul 01, 2012 at 06:50:09PM +0200, Slappinjohn wrote:
> so let's see how far we got...
> I managed to set up a set of testdatabases and got replication working
> over the internet - GOOD!
> I tried it with a gnumed_v16 database (sorry not up-to-date, I know)
> applied the SQL-Patch Karsten send me, set up bucardo, tried to add a
> sync and BOOM! It's not working.
> Hours of testing later, one night to sleep over... And I got it.
> The error message said something about you can't use INSERT on a
> read-only connection... I think the gnumed-database is set to "set
> default_transaction_read_only to on", right? - TADA
Nice. Did you yet notice any difference in
> Any solutions to get around this without setting
> default_transaction_read_only to off permanently?
Not really due to the very nature of things. The default
setting in GNUmed is readonly in order to prevent
"accidental" connections to be able to write to the database
without taking explicit action. The read-write transactions
inside GNUmed do nothing but - they request explicit
read-write after establishing a readonly connection.
So, Bucardo needs to do the same thing.
Since it is unlikely (though not impossible to imagine) that
Bucardo is prepared to run special code before doing any
writes one must find another way to achieve that.
Now, PostgreSQL can store database settings specific to the
user which override those having been stored specific to a
database (such as default_readonly=True for gnumed_vXX).
So what I would suggest doing is to
- create a dedicated user with r/w access to the gnumed_vXX
in question (the easiest would be to create a staff member
inside GNUmed and use the database account thereof)
- use that database account for Bucardo replication
- ALTER that USER to have default_transaction_read_only to OFF
That would *localize* the default=write as much as possible.