patch for preventing the specification of conflicting transaction read/write options

Lists: pgsql-hackers
From: Chetan Suttraway <chetan(dot)suttraway(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: patch for preventing the specification of conflicting transaction read/write options
Date: 2012-02-07 13:02:18
Message-ID: CAPtHcnEEF2iW4gOdbEy8P-ZOzBxPpFD9pZB14uRUbmZ+KK1ujg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

This is regarding the TODO item:
"Prevent the specification of conflicting transaction read/write options"

listed at:
http://wiki.postgresql.org/wiki/Todo

The issue is :

SET TRANSACTION read only read write read only;

The fix involved iteration over transaction_mode_list and checking for
duplicate entries.
The patch is based on suggestions mentioned in message:
http://archives.postgresql.org/pgsql-hackers/2009-01/msg00692.php

As per this, the patch does not throw any error for the first test case
mentioned above.
It throws error only in case of conflicting modes.

For ex:
postgres=# SET TRANSACTION read only read only;
SET

postgres=# SET TRANSACTION read only read write;
ERROR: conflicting options
LINE 1: SET TRANSACTION read only read write;
^

Below are basic unit test logs:

postgres=# SET TRANSACTION ISOLATION LEVEL serializable ISOLATION LEVEL
serializable;
SET
postgres=# SET TRANSACTION ISOLATION LEVEL serializable ISOLATION LEVEL
repeatable read;
ERROR: conflicting options
LINE 1: SET TRANSACTION ISOLATION LEVEL serializable ISOLATION LEVEL...

postgres=# SET TRANSACTION DEFERRABLE DEFERRABLE;
SET
postgres=# SET TRANSACTION DEFERRABLE NOT DEFERRABLE;
ERROR: conflicting options
LINE 1: SET TRANSACTION DEFERRABLE NOT DEFERRABLE;
^
postgres=# START TRANSACTION read only, read only;
START TRANSACTION
postgres=# rollback;
ROLLBACK
postgres=# START TRANSACTION read only, read write;
ERROR: conflicting options
LINE 1: START TRANSACTION read only, read write;
postgres=# rollback;
ROLLBACK ^
postgres=# BEGIN TRANSACTION ISOLATION LEVEL serializable, ISOLATION LEVEL
serializable;
BEGIN
postgres=# rollback;
ROLLBACK
postgres=# BEGIN TRANSACTION ISOLATION LEVEL serializable, ISOLATION LEVEL
repeatable read;
ERROR: conflicting options
LINE 1: BEGIN TRANSACTION ISOLATION LEVEL serializable, ISOLATION LE...
^

Please pass on any inputs on the patch.

Regards,
Chetan

--
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

Website: www.enterprisedb.com
EnterpriseDB Blog : http://blogs.enterprisedb.com
Follow us on Twitter : http://www.twitter.com/enterprisedb

Attachment Content-Type Size
fix_set_trans_mode.patch text/x-diff 2.4 KB

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Chetan Suttraway" <chetan(dot)suttraway(at)enterprisedb(dot)com>, "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: patch for preventing the specification of conflicting transaction read/write options
Date: 2012-02-07 15:14:02
Message-ID: 4F30EB5A0200002500044F26@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Chetan Suttraway <chetan(dot)suttraway(at)enterprisedb(dot)com> wrote:

> This is regarding the TODO item:
> "Prevent the specification of conflicting transaction read/write
> options"
>
> listed at:
> http://wiki.postgresql.org/wiki/Todo

Thanks for chipping away at items on the list.

> Please pass on any inputs on the patch.

Right now we want people focusing on fixing bugs and reviewing
patches submitted by the start of the current CommitFest. Please
add this to the open CF so we don't lose track of it.

-Kevin


From: Chetan Suttraway <chetan(dot)suttraway(at)enterprisedb(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: patch for preventing the specification of conflicting transaction read/write options
Date: 2012-02-08 06:39:34
Message-ID: CAPtHcnFO5YGX0x-7u18+XJHkdxb+=HwgAUf1jsThyz2ToELP6A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Feb 7, 2012 at 8:44 PM, Kevin Grittner
<Kevin(dot)Grittner(at)wicourts(dot)gov>wrote:

> Chetan Suttraway <chetan(dot)suttraway(at)enterprisedb(dot)com> wrote:
>
> > This is regarding the TODO item:
> > "Prevent the specification of conflicting transaction read/write
> > options"
> >
> > listed at:
> > http://wiki.postgresql.org/wiki/Todo
>
> Thanks for chipping away at items on the list.
>
> > Please pass on any inputs on the patch.
>
> Right now we want people focusing on fixing bugs and reviewing
> patches submitted by the start of the current CommitFest. Please
> add this to the open CF so we don't lose track of it.
>
> -Kevin
>

Sure.

Thanks!

-Chetan

--
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

Website: www.enterprisedb.com
EnterpriseDB Blog : http://blogs.enterprisedb.com
Follow us on Twitter : http://www.twitter.com/enterprisedb