New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
postgres support for serializable transactions instead of just read committed #1754
Comments
6th Apr 2010, Dieter Plaetinck said: Scratch the "in an application, you can just do" part. |
7th Apr 2010, Jose Lorenzo Rodríguez said: Dieter, Thanks for your suggestion, it will be taken in account for next releases. Meanwhile, and contrary to what you have explained in your follow up response, it is possible to do it in the application level. Let's suppose you have model Post, you can initiate the transaction this way: $Post->getDataSource()->begin($Post); and then set the transaction type by yourself doing $Post->query('START TRANSACTION ISOLATION LEVEL SERIALIZABLE'); No need to scratch that part :) Thanks again your suggestion |
7th Apr 2010, Dieter Plaetinck said: yep you're right. but it's 'SET' not 'START' |
10th Apr 2010, Stephen Cuppett said: Here's a tiny patch that implements this. Do not have any tests yet, but it was pretty trivial. It adds a datasource configuration parameter "serializable" (true|false, default false). Not sure if the term is good or not. I also noticed that _commands is duplicated in DboPostgres from DboSource unnecessarily, took that out so the patch actually results in -7 lines of code. |
10th Apr 2010, Stephen Cuppett said: Sorry, didn't pay close enough attention to the doc. The SET command is only valid inside a transaction block, not for the whole connection. Not sure the real desire, a parameter could be added to the Model->begin($serializable = false) method to override the one in DboSource or I've attached another patch that instead just updates the $_command for begin to the START command using the same datasource connection parameter. |
12th Apr 2010, Dieter Plaetinck said: the serializable property should definitely be changeable on a per-transaction basis. |
closing as duplicate of #3136 |
Created by Dieter Plaetinck, 6th Apr 2010. (originally Lighthouse ticket #548):
Postgres supports 2 kinds of transactions, see
http://www.postgresql.org/docs/8.4/interactive/mvcc.html
There currently is no proper way to do serializable transaction queries on postgres with cakephp.
There are two ways to make a transaction serializable:
see
http://www.postgresql.org/docs/7.4/interactive/sql-set-transaction.html
http://www.postgresql.org/docs/8.4/interactive/sql-start-transaction.html
In an application, you can just do
$Model->query('START TRANSACTION ISOLATION LEVEL SERIALIZABLE');
but it would be nice if cake had support out of the box for this.
I would submit a patch myself, but I'm not sure how i should implement this. any pointers?
But the fix may be more trivial then the explanation, so feel free :)
Dieter
The text was updated successfully, but these errors were encountered: