Re: Edit Grid and default_transaction_read_only - Mailing list pgadmin-hackers

From Guillaume Lelarge
Subject Re: Edit Grid and default_transaction_read_only
Date
Msg-id 1340867479.1823.4.camel@localhost.localdomain
Whole thread Raw
In response to Edit Grid and default_transaction_read_only  (J Chapman Flack <jflack@math.purdue.edu>)
Responses Re: Edit Grid and default_transaction_read_only
List pgadmin-hackers
On Wed, 2012-06-20 at 09:55 -0400, J Chapman Flack wrote:
> Hi,
>
> I've never hacked on pgAdmin yet, so I'm curious from those who have:
>

Sorry for not answering sooner. Way overloaded here.

> What sounds like the smartest way to make updates in the Edit Grid
> not fail when connected to a database with default_transaction_read_only
> set to on? :
>
> 1. Just send every update wrapped in START TRANSACTION READ WRITE
>     ... COMMIT ?
>
> 2. Don't do that by default, but trap the "error: transaction is
>     read only" and reissue the update with START TRANSACTION READ WRITE
>     in that case?
>
> 3. Query the backend for SHOW DEFAULT_TRANSACTION_READ_ONLY and then
>     issue updates wrapped in START TRANSACTION READ WRITE only if it
>     was ON?
>
> 4. Just send a SET SESSION DEFAULT_TRANSACTION_READ_ONLY TO OFF and
>     forget about it?
>
> I'm asking because we noticed in 1.14.2 that it doesn't do any of
> these things yet, but just surprises the innocent user with the
> "error: transaction is read only".
>

Well, if the DBA sets default_transaction_read_only to off, it's for a
good reason. So, we shouldn't override this by default. It would be
better that the edit tool finds that default_transaction_read_only is
on, and asks if the user wants to turn it off so that he could make
INSERT/DELETE/UPDATE.


--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com


pgadmin-hackers by date:

Previous
From: "pgAdmin Trac"
Date:
Subject: [pgAdmin III] #365: pg_terminate_backend() can be used on backends with matching role on 9.2
Next
From: Dave Page
Date:
Subject: Re: [pgadmin-support] Compile Source Code