Problem with PostgreSQL autoincrement sequence
Status: Beta
Brought to you by:
wgeric
In easymod_install.php at line 937 :
case 'postgresql':
if\( $create\_easymod\_table \)
\{
$sql\[\] = "CREATE SEQUENCE " . EASYMOD\_TABLE .
"_mod_id_seq start 1 increment 1 maxvalue 2147483647
minvalue 1 cache 1";
$sql\[\] = "CREATE TABLE " . EASYMOD\_TABLE . " \(
mod\_id int4 NOT NULL DEFAULT nextval\('" .
EASYMOD_TABLE . "_mod_id_seq'::text),
I think there we must replace "_mod_id_seq" with
"_id_seq". Indeed, in phpBB2 file db/postgres7.php,
in function sql_nextid(), there is next SQL code :
"SELECT currval('" . $tablename[1] . "_id_seq') AS
last_value";
And so, for sql_nextid() to work, all sequences MUST
have next name :
tablename_id_seq, and not tablename_mod_id_seq !
I am developping a mod which works fine with MySQL
and after this small code correction it works fine
with Postgres to.
Am I right ? If yes, it would be nice to correct
it in next easymod version.
Regards
Logged In: YES
user_id=1242849
Originator: NO
You are correct, and this is not the only EasyMod problem w/ PostgreSQL; see report 1680118.
Logged In: YES
user_id=1265254
Originator: NO
This bug has been fixed in CVS and will appear in the next
version of EasyMOD. Thank you for reporting it.