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
pgsql: Insert_ID() - PostgreSQL8 driver assumes that lastval() will be set. #978
Comments
Link to CI build with this fixed. FYI, something between 5.22.5 & present broke the return from calls to |
I just tried this and it seems to return false as expected - am I missing something ? include 'adodb.inc.php';
$db = ADONewConnection('pgsql');
$db->connect(...);
var_dump($db->insert_id()); // false |
Ah I get it - the problem occurs when using exceptions, i.e. with Fatal error: Uncaught ADODB_Exception: postgres9 error: [-1: ERROR: lastval is not yet defined in this session] in EXECUTE("SELECT lastval()") in /Users/dregad/dev/adodb/adodb-exceptions.inc.php on line 97 which matches the error reported in your CI. I'll have a look at your PR. |
Is it possible to backport this fix into the 5.21 and/or the 5.20 lines. At the moment, it may be necessary to downgrade my project's maximum supported ADOdb versions to 5.17 on older PHPs. I CI test against the minimum supported versions, If I had tested against the maximum supported versions, this issue would have been present in the PHP 5 tests as well. I'll take into account users running ADOdb 5.18 - 5.22.5 and compensate for this error in my project's code, when the installed version of ADOdb does not. Giving the end uses who for whatever reasons are using older PHP's an upgrade path for older ADOdb's would be greatly appreciated if possible. |
I have PR #983 for the 5.21 codebase. I have https://github.com/NathanGibbs3/ADOdb/tree/NathanGibbs3-Issue%23978for5.20 in my fork for the 5.20 codebase.
Hopefully that will avoid adding any 5.21+ code into it, if you choose to use it. |
For what it's worth, I'm nor including the exception handler, just the error handler. |
ADOdb 5.22x #984 |
I'm sorry, but I need to take a strong stance here and reject this request. Our support policy and the reason for it are quite clearly stated on our website (and we even discussed that last week) - only stable (5.22.x as of this writing) and legacy (5.21.x) releases are supported, and the latter only gets security and critical bug fixes. Unfortunately, this bug hardly qualifies as critical. I suggest you patch your code to work around the problem, or alternatively feel free to maintain a modified copy of ADOdb. |
I understand.
to the position of If you want them in the future., they are there. As I've stated and in alignment with your suggestion. Thank you again for your consideration . |
Thanks for your understanding 😃 |
Description
Getting the error and stack trace below in CI when calling
Insert_ID()
on a newly initialized ADOdb object connected to a PostgreSQL DB.Environment
Steps to reproduce
Detailed, step-by-step instructions to reproduce the behavior, including:
Insert_ID()
.Expected behavior
Would expect
Insert_ID()
to return false as per the documentation and not throw an error.Additional context
Link to CI build were we can see the breakage on PostgreSQL for PHP versions using ADOdb 5.20+
https://app.travis-ci.com/github/NathanGibbs3/BASE/builds/263709789
The text was updated successfully, but these errors were encountered: