Confirmed on both new install and upgrade installs of SMF 2.0 RC2 using PostgreSQL as the database backend. I am hosting it on a stock Debian Stable distro using LigHTTPd and PHP5 in FastCGI, software versions are as follows:
LigHTTPd 1.4.19
PHP 5.2.6-1+lenny3
PostgreSQL 8.3.8
XCache 1.2.2
The problem is with the handling code in Sources/Subs-Db-postgresql.php, specifically the routine for setting up an UPDATE template for a "replace" query. By replacing the file with the RC1 version the forum is usable, further debugging determined it to be the following routine change between RC1 and RC2.
*** 579,600 ****
// Setup an UPDATE template.
$updateData = '';
$where = '';
- $count = 0;
foreach ($columns as $columnName => $type)
{
// Are we restricting the length?
if (strpos($type, 'string-') !== false)
! $actualType = sprintf($columnName . ' = SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $count);
else
! $actualType = sprintf($columnName . ' = {%1$s:%2$s}, ', $type, $count);
// Has it got a key?
if (in_array($columnName, $keys))
$where .= (empty($where) ? '' : ' AND ') . substr($actualType,0, -2);
else
$updateData .= $actualType;
-
- $count++;
}
$updateData = substr($updateData, 0, -2);
--- 613,631 ----
// Setup an UPDATE template.
$updateData = '';
$where = '';
foreach ($columns as $columnName => $type)
{
// Are we restricting the length?
if (strpos($type, 'string-') !== false)
! $actualType = sprintf($columnName . ' = SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $columnName);
else
! $actualType = sprintf($columnName . ' = {%1$s:%2$s}, ', $type, $columnName);
// Has it got a key?
if (in_array($columnName, $keys))
$where .= (empty($where) ? '' : ' AND ') . substr($actualType,0, -2);
else
$updateData .= $actualType;
}
$updateData = substr($updateData, 0, -2);
That removal of $count and changing the sprintfs to have $columnName rather than $count as the last argument breaks any operation that results in an SQL update. By reverting it back to the RC1 changes, it works perfectly. Attached is a diff for the exact patch to be made. Apply with "patch -p1 < /path/to/diff" while in your SMF install location.
I asked about a similar (or identical) problem in the suport forum. So, I guess it's worth adding my voice here:
I cannot install RC2 freshly on the following setup:
MacOSX 10.5.8
Apache 2.2.13
PHP 5.2.11
postgres 8.3.5
Failes on step 5 and leaves me with a bord with just the plain text error as stated in the subject of this thread.
My detailed report can be found here (http://www.simplemachines.org/community/index.php?topic=349375.0).
thanks
Seems to be PostgreSQL that's the common factor.
There are some issues still in it though :(
Well I understand it's still very much a beta candidate and I don't mind making a few tweaks and code fixes to get it working properly. It's nice that PostgreSQL support is being attempted at all. I can't stand MySQL and noone else seems to want to give PostgreSQL some love :\
I'm still testing everything out on RC2 before I move my production forum to it from RC1, will report if I find anything else broken.
Quote from: TheStupidOne on November 18, 2009, 12:31:55 PM
The problem is with the handling code in Sources/Subs-Db-postgresql.php, specifically the routine for setting up an UPDATE template for a "replace" query. By replacing the file with the RC1 version the forum is usable, further debugging determined it to be the following routine change between RC1 and RC2.
*** 579,600 ****
// Setup an UPDATE template.
$updateData = '';
$where = '';
- $count = 0;
foreach ($columns as $columnName => $type)
{
// Are we restricting the length?
if (strpos($type, 'string-') !== false)
! $actualType = sprintf($columnName . ' = SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $count);
else
! $actualType = sprintf($columnName . ' = {%1$s:%2$s}, ', $type, $count);
// Has it got a key?
if (in_array($columnName, $keys))
$where .= (empty($where) ? '' : ' AND ') . substr($actualType,0, -2);
else
$updateData .= $actualType;
-
- $count++;
}
$updateData = substr($updateData, 0, -2);
--- 613,631 ----
// Setup an UPDATE template.
$updateData = '';
$where = '';
foreach ($columns as $columnName => $type)
{
// Are we restricting the length?
if (strpos($type, 'string-') !== false)
! $actualType = sprintf($columnName . ' = SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $columnName);
else
! $actualType = sprintf($columnName . ' = {%1$s:%2$s}, ', $type, $columnName);
// Has it got a key?
if (in_array($columnName, $keys))
$where .= (empty($where) ? '' : ' AND ') . substr($actualType,0, -2);
else
$updateData .= $actualType;
}
$updateData = substr($updateData, 0, -2);
That removal of $count and changing the sprintfs to have $columnName rather than $count as the last argument breaks any operation that results in an SQL update. By reverting it back to the RC1 changes, it works perfectly. Attached is a diff for the exact patch to be made. Apply with "patch -p1 < /path/to/diff" while in your SMF install location.
Confirmed, and it's already fixed at this point in svn. Thank you for your report.