Re: Performance question: Commit or rollback? - Mailing list pgsql-general

From Darren Duncan
Subject Re: Performance question: Commit or rollback?
Date
Msg-id 4EF62929.4080806@darrenduncan.net
Whole thread Raw
In response to Re: Performance question: Commit or rollback?  (Chris Angelico <rosuav@gmail.com>)
Responses Re: Performance question: Commit or rollback?
List pgsql-general
Chris Angelico wrote:
> On Sat, Dec 24, 2011 at 11:46 PM, vinny <vinny@xs4all.nl> wrote:
>> How about using a databaseuser that has it's create/update/delete rights
>> revoked? That will cause an error if the supposedly read-only routine
>> does try to change data.
>
> Also, we want to minimize debugging time by having
> both read-only and read-write access use almost exactly the same code
> and DB access, meaning that we should not need to test every module in
> every mode.

You can do it correctly while reusing all of your code; you just have different
arguments at connect time and otherwise your code uses the connection handle in
the same way afterwards.  Its fine to have flags in the app so the app just
tries acceptable things, but privileges in the database are the only way to
actually be safe and resilient against accidental changes. -- Darren Duncan

pgsql-general by date:

Previous
From: Vincent Veyron
Date:
Subject: Re: PostgreSQL DBA in SPAAAAAAAACE
Next
From: Alban Hertroys
Date:
Subject: Re: postgresql triggers - defining a global resource (java)