Lists: | pgsql-patches |
---|
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Allow SET to not start a transaction |
Date: | 2002-10-06 04:36:07 |
Message-ID: | 200210060436.g964a7v11355@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
We have on the open items list:
Make SET not start a transaction with autocommit off, document it
The attached patch does exactly that (though without documentation). It
checks for the TRANS_DEFAULT transaction state, which is the state right
after a COMMIT. If the backend is in that state, and autocommit is off,
and the command is SET/SHOW/RESET, then a COMMIT will be forced, rather
than keeping the transaction open for the next command. It seems to
work, but i want to test it more before applying to CVS.
---------------------------------------------------------------------------
test=> set autocommit = off;
SET
test=> commit;
WARNING: COMMIT: no transaction in progress
COMMIT
test=> set statement_timeout = 9999999;
SET
test=> select 1;
?column?
----------
1
(1 row)
test=> abort;
ROLLBACK
test=> show statement_timeout;
statement_timeout
-------------------
9999999
(1 row)
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 3.8 KB |
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: Allow SET to not start a transaction |
Date: | 2002-10-09 04:58:47 |
Message-ID: | 200210090458.g994wll09989@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
OK, I have finished the patch and applied it, with doc updates.
---------------------------------------------------------------------------
Bruce Momjian wrote:
> We have on the open items list:
>
> Make SET not start a transaction with autocommit off, document it
>
> The attached patch does exactly that (though without documentation). It
> checks for the TRANS_DEFAULT transaction state, which is the state right
> after a COMMIT. If the backend is in that state, and autocommit is off,
> and the command is SET/SHOW/RESET, then a COMMIT will be forced, rather
> than keeping the transaction open for the next command. It seems to
> work, but i want to test it more before applying to CVS.
>
> ---------------------------------------------------------------------------
>
> test=> set autocommit = off;
> SET
> test=> commit;
> WARNING: COMMIT: no transaction in progress
> COMMIT
> test=> set statement_timeout = 9999999;
> SET
> test=> select 1;
> ?column?
> ----------
> 1
> (1 row)
>
> test=> abort;
> ROLLBACK
> test=> show statement_timeout;
> statement_timeout
> -------------------
> 9999999
> (1 row)
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 7.7 KB |