Getting this error when I submit a new bug:
currval of sequence "mantis_email_table_id_seq" is not yet defined in this session for the query:
I can run an insert from the psql command line and it works fine. I tried nextval but even though the insert worked the whole process didn't work because the tie in inserts like the text field custom field inserts didn't find the correct id number because they are calling currval as well so the keys are off.
I'm on Redhat SE 4, postres 8.2.4, PHP Version => 5.2.3, mantis version 1.1.0a4
The same version works great on mysql. I'm under constraints to use postgres. Any help would be greatly appreciated.
postgres sequence problems
Moderators: Developer, Contributor
-
- Posts: 1
- Joined: 31 Oct 2007, 01:31
- Contact:
Re: Postgres Sequence Problems
I had the same problem. My fix was probably quite a bit more than was necessary, and I think the root of it is that the column name of the email table is "email_id" rather than "id."
There is a function in database_api.php called
db_insert_id($p_table = null)
which i changed to
db_insert_id($p_table = null,$p_column = "id")
and changed the query string to
$query = "SELECT currval('" . $p_table . "_" . $p_column . "_seq')";
and then also changed the call to that function email_queue_api.php line 107 to
return db_insert_id( $t_email_table, "email_id" );
There is a function in database_api.php called
db_insert_id($p_table = null)
which i changed to
db_insert_id($p_table = null,$p_column = "id")
and changed the query string to
$query = "SELECT currval('" . $p_table . "_" . $p_column . "_seq')";
and then also changed the call to that function email_queue_api.php line 107 to
return db_insert_id( $t_email_table, "email_id" );
Re: postgres sequence problems
The fix looks good. I've added a link to this thread from:
http://www.mantisbt.org/bugs/view.php?id=7616
I've sent a message to paulr (currently looking after pgsql) to apply the fix and validate it.
http://www.mantisbt.org/bugs/view.php?id=7616
I've sent a message to paulr (currently looking after pgsql) to apply the fix and validate it.
Migrate your MantisBT to the MantisHub Cloud