Skip site navigation (1) Skip section navigation (2)

Re: Edit Grid and default_transaction_read_only

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: J Chapman Flack <jflack(at)math(dot)purdue(dot)edu>
Cc: pgadmin-hackers(at)postgresql(dot)org
Subject: Re: Edit Grid and default_transaction_read_only
Date: 2012-06-28 07:11:19
Message-ID: 1340867479.1823.4.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: 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


In response to

Responses

pgadmin-hackers by date

Next:From: Jiby JamesDate: 2012-06-28 07:55:17
Subject: Compile Source Code
Previous:From: pgAdmin TracDate: 2012-06-27 20:46:25
Subject: [pgAdmin III] #365: pg_terminate_backend() can be used on backends with matching role on 9.2

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group