[2.0.0-beta 2] spamblock table updates fail on pgsql
Posted: Sat Jun 21, 2014 12:40 am
Just had the following error:
Could like it's due to mysql-specific code in plugins/serendipit_event_spamblock/serendipity_event_spamblock.php line 705 and 708 where the following lines is:
Per specs (http://www.postgresql.org/docs/9.1/stat ... table.html) Posgresql want it to be: ALTER TABLE ... ALTER COLUMN ip TYPE VARCHAR(45), it worked for me by changing the lines to:
Code: Select all
Fatal error: Uncaught exception 'ErrorException' with message 'pg_query(): Query failed: ERROR: syntax error at or near "CHANGE"
LINE 1: ALTER TABLE serendipity_spamblocklog CHANGE COLUMN ip ip VAR...
^' in /usr/home/rohdef/www/armchair/include/compat.inc.php:126
Stack trace:
#0 [internal function]: errorToExceptionHandler(2, 'pg_query(): Que...', '/usr/home/rohde...', 222, Array)
#1 /usr/home/rohdef/www/armchair/include/db/postgres.inc.php(222): pg_query(Resource id #22, 'ALTER TABLE ser...')
#2 /usr/home/rohdef/www/armchair/include/db/postgres.inc.php(298): serendipity_db_query('ALTER TABLE ser...')
#3 /usr/home/rohdef/www/armchair/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php(706): serendipity_db_schema_import('ALTER TABLE ser...')
#4 /usr/home/rohdef/www/armchair/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php(849): serendipity_event_spamblock->checkScheme()
#5 /usr/home/rohdef/www/armchair/include/plugin_api.inc.php(1107 in /usr/home/rohdef/www/armchair/include/compat.inc.php on line 126
Code: Select all
704 if ($dbversion == '2') {
705 $q = "ALTER TABLE {$serendipity['dbPrefix']}spamblocklog CHANGE COLUMN ip ip VARCHAR(45)";
706 $sql = serendipity_db_schema_import($q);
707
708 $q = "ALTER TABLE {$serendipity['dbPrefix']}spamblock_htaccess CHANGE COLUMN ip ip VARCHAR(45)";
709 $sql = serendipity_db_schema_import($q);
710
711 $this->set_config('dbversion', '3');
712 }
Code: Select all
704 if ($dbversion == '2') {
705 $q = "ALTER TABLE {$serendipity['dbPrefix']}spamblocklog ALTER COLUMN ip TYPE VARCHAR(45)";
706 $sql = serendipity_db_schema_import($q);
707
708 $q = "ALTER TABLE {$serendipity['dbPrefix']}spamblock_htaccess ALTER COLUMN ip TYPE VARCHAR(45)";
709 $sql = serendipity_db_schema_import($q);
710
711 $this->set_config('dbversion', '3');
712 }