php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #26592 PostgreSQL 7.4 has autocomit option left to client
Submitted: 2003-12-11 16:22 UTC Modified: 2003-12-11 20:24 UTC
Votes:9
Avg. Score:3.7 ± 1.6
Reproduced:6 of 8 (75.0%)
Same Version:4 (66.7%)
Same OS:4 (66.7%)
From: aspire420 at hotpop dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.3.4 OS: Linux RH 9.0
Private report: No CVE-ID: None
 [2003-12-11 16:22 UTC] aspire420 at hotpop dot com
Description:
------------
As on PostgreSQL version 7.4 the autocommit option has been rested upon the client side i.e if I would like to  put autocommit = off in PostgreSQL 7.4 > then it must appear some where in PHP.INI.
But till the latest version of PHP I dont see any such option.

Expected result:
----------------
in PHP.ini
PostgreSQL autocommit = off 
or may be we do it with some configure strings


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-11 16:37 UTC] aspire420 at hotpop dot com
some configuration string would be better
 [2003-12-11 17:14 UTC] peter_e at gmx dot net
This is actually a pretty bad idea.  The autocommit setting 
should be controlled either by making it fixed at on or off 
for the interface, or by the client program itself (e.g., a 
"set autocommit on" function), but not by a global setting, 
because then you'll never be able to reconcile various 
prepackaged PHP applications.  The excessive global-ness 
was the reason that the server-side autocommit setting was 
removed in the first place.
 [2003-12-11 17:22 UTC] not at anumber dot com
Autocommit considered harmful.

The consumers of database resources within an application server should decide how transactional behaviour works, not the application server itself.

This is analogous to the rule (now, too frequently broken) that MTAs should not mess with message bodies.

What if my app has a multi-request series of action that should succeed or fail as a group?
 [2003-12-11 17:31 UTC] scott dot marlowe at ihs dot com
QUOTE:
What if my app has a multi-request series of action that should succeed
or fail as a group?
UNQUOTE:

Then you need to enclose them in begin;/end; pairs.  Simple enough.
 [2003-12-11 18:30 UTC] sniper@php.net
I'm really not Postgresql expert (never used it actually :),
but according to this documentation:

  http://www.postgresql.org/docs/7.4/static/sql-begin.html

"By default (without BEGIN), PostgreSQL executes transactions in "autocommit" mode..."

So if I understood that correctly, to turn it off you just need to begin your queries with 'BEGIN' and end with 'COMMIT' to "disable" autocommit?

Now why would you need yet another php.ini option for this?!

 [2003-12-11 20:24 UTC] aspire420 at hotpop dot com
Yes ,

You people are right 
Let me clarify :
1. PostgreSQL Version 7.4 > are by default in autocomit mode 
   i.e the postgresql.conf entry has been removed to control this
2. Try doing this on < 7.4 
   cs=# set autocommit=off;
   SET 
    This means Sucess
   But on 7.4 this fails
3. So whosoever wants to control the Autocomit feature would have to work with BEGIN AND COMMIT block
What does this mean :-
That all those application that where not using BEGIN and COMMIT block with PostgreSQL < 7.4 will easylu port to 7.4
But
Those who were relying on postgresql.conf feature will have 
have to look around and introduce BEGIN and COMMIT block.

--------------
If I am wrong then please take this bug as feature request
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 10:01:28 2024 UTC