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
[FIX] - Fix PHP original PDO_PGSQL::lastInsertId #2328
Conversation
…lains about a sequence that has not been used it on the transaction (error): Object not in prerequisite state: 7 ERROR: currval of sequence sequence_name is not yet defined in this session
@deeky666 is 2.4 still maintained? |
* | ||
* @return \Doctrine\DBAL\Driver\PDOPgSql\Exception | ||
*/ | ||
static public function fromErrorInfo($error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No way!!! Please, note the namespace.
https://github.com/doctrine/dbal/pull/2328/files#diff-bb13d524a0e6064b2a578f84c62c2ff5R66
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I see that you use the constructor, not this named constructor...
@phackwer what kind of situation triggers the problem? Can you reproduce it in a test case? |
Marco, How to trigger: This is a PHP bug (which I will also and still send the fix - here's the cause (https://github.com/php/php-src/blob/master/ext/pdo_pgsql/pgsql_driver.c#L375), and this is a Doctrine workaround to allow Doctrine to still work with earlier PHP versions, since bugfix will be avaliable only on 5.6.x and 7.x. Answering about branch 2.4, I don't know if it's still maintened, but you (specifically you) have made the 2.4.5 release earlier these year and it is marked as the latest release. Also this is the one we are using here in Brazil with some government clients that insists on force us to make code compatible with PHP 5.3.3, just because this is the one supported by RedHat "Enterprice" Linux 6, which is the one they have support contracts. Maybe I should upgrade to 2.5.x, but still, this fix should be made. About the PHP bug, you can google it just to find out that this is a big that affects thousands of people around the world. The correct solution PostgreSQL solution since version 8.1 is to call the LASTVAL() function instead of using the currval old option. Releases (latest is yours and on 2.4 branch): |
About tests: I will try to write them. So far, the bug seems a critical one and fixes doctrine for thousands of systems. |
As you can see here, also phalcon has this problem, since it is PHP's bug: |
Any idea of when will your database be avaliable again? This build error has no relation to my code: |
Ah yes, we do not support php <5.4 anymore. Unless there is a security issue, this patch will only land in 2.5 |
:-( Can't you at least make a final release to overwrite this PHP problem for those who must use 2.4.x? Just this last pull request? XD |
I've got the same situation here. |
+1 vote on thia pull request. Same issue here. |
+1 vote for this pull request. |
This is not a security issue. Don't think it's gonna happen. The merge will happen for 2.5.x. As you pointed out to me, for 2.4.x, the workaround is to simply use your own custom platform. @ the other 3 that "upvoted" - upvoting has nothing to do with release schedules, sorry :-\ |
I've got the same situation here. |
This has been fixed directly on PHP source by myself. |
Fix PHP original PDO_PGSQL::lastInsertId which sometimes complains
about a sequence that has not been used it on the transaction (error):
Object not in prerequisite state: 7 ERROR: currval of sequence sequence_name is not yet defined in this session