News:

Wondering if this will always be free?  See why free is better.

Main Menu

Fresh install on postgresql fails

Started by habakuk, November 21, 2009, 07:43:06 AM

Previous topic - Next topic

habakuk

Full of joy, I went and tried to upgrade my forum (more precise: a copy of my forum of course!) from rc1 to rc2. That didn't work in any way. So, I decided to go the other way round and do a fresh install of rc2 and use that code base to add my own stuff later.

Sadly, this didn't work either. Here's the details.

MacOSX 10.5.8
Apache  2.2.13
PHP 5.2.11
postgres 8.3.5
pure-ftp 1.0.x

- Using the full installer, unzipped it in a properly accessible folder inside htdocs of apache2
- created the postgres db  (utf8-ready)
- started the installer (install.php)
- went through to step 3 where I encountered the first bummer:



http://dev.goodeye.ch/install.php?step=3

Critical Error!
The current version of your database doesn't support the use of the UTF-8 character set. You can still install SMF without any problems, but only with UTF-8 support unchecked. If you would like to switch over to UTF-8 in the future (e.g. after the database server of your forum has been upgraded to version >= 7.4.10), you can convert your forum to UTF-8 through the admin panel.





Couldn't find out easily where the db version check is failing. We have 8.3.5 and use utf8 all the time so this error is unclear to me.

Anyway. Switched off the UTF8-Defaults checkbox, planning to convert that db later, before importing data.

Now, the process went through to the step 5 when the admin account needs to be defined. And then things went down the drain. The step failed with many undefined index errors and data type problems:



Notice: Undefined index: theme_guests in /Library/Apache2/htdocs/testforum/Sources/Load.php on line 1340

Notice: Undefined index: permissions in /Library/Apache2/htdocs/testforum/Sources/Security.php on line 832

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /Library/Apache2/htdocs/testforum/Sources/Security.php on line 832

Notice: Undefined index: mod_cache in /Library/Apache2/htdocs/testforum/Sources/Load.php on line 1527

Notice: Undefined index: username in /Library/Apache2/htdocs/testforum/Sources/Load.php on line 1528

Notice: Undefined index: language in /Library/Apache2/htdocs/testforum/Sources/Load.php on line 1529

Notice: Undefined index: email in /Library/Apache2/htdocs/testforum/Sources/Load.php on line 1530

Notice: Undefined index: ignoreusers in /Library/Apache2/htdocs/testforum/Sources/Load.php on line 1531



etc. etc.

From that point on, the installation is broken and I cannot even go back to a previous step. Trying the access the forum results in a plain text page:

>  The database value you're trying to insert does not exist: value

The tables have been written but index creation failed and then it's all gone. I had to delete the whole database. Tried the whole installation three times.

I fear there is somehting seriously broken with the installer ON POSTGRES.

We have a second SMF rc1 installation on the same server. There, the UPGRADE went smooth. Same PHP, same Postgres... the difference is, that rc1 installation wasn't modified in any way.

In short:
- plain rc1 -> upgrade to rc2 went smooth
- modified rc2 -> upgrade failed (not really surprised by that)
- fresh rc2 on the very same machine/setup failed totally.


cheers
®









Norv

Thank you for all the details you give. I'm afraid you may be right, RC2 on postgres might have some unforseen problems, unfortunately I am unable to check very soon, but SMF 2.0 RC2 reports for postgresql are on my todo list.
In case you may want to see other issues and possible discussions/workarounds, please feel free to check out:
http://www.simplemachines.org/community/index.php?topic=350398.0
http://www.simplemachines.org/community/index.php?topic=348876.msg0#new

To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

habakuk

Thanks much for your feedback.

In the mean time, I verified the problem with a second machine: fresh install of MacOS 10.5, freshly compiled postgresql 8.4.x (previous tests were done with postgresql 8.3), fresh download of the full installer. Still getting the same problems.

So I can add, the same problems happen on virgin installations and on a different postgresql version too.

cheers
®

Norv

Postgresql 8.4.1 binary build, default settings, on Debian Squeeze.
I just installed RC2 public on my machine. I can confirm the first error, too, about Postresql version not being UTF8 able (and it was), though strangely enough, at the second attempt to install in what I think to be the same conditions, it didn't happen anymore, and it installed very nicely on a UTF8 database. (gremlins, I say)
I cannot confirm any of the rest of problems, though, the new installation seems just fine. Admittedly, it has nothing but a couple of posts and users, for the time being.

ETA: I'll move your thread at Bug Reports, as there seem to be some issues in RC2 concerning Postgresql, and for easier traceability, if that's okay with you.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Norv

#4
Update:
please consider making the following fix in Subs-Db-Postgresql.php:
Code (find) Select

if (count($data) > 1 && !$db_in_transact && !$disable_trans)

Code (replace) Select

if (((count($data) > 1) || ($method == 'replace')) && !$db_in_transact && !$disable_trans)

Code (find) Select

// PostgreSQL doesn't support replace or insert ignore so we need to work around it.
if ($method == 'replace')
{
// 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);

// Try and update the entries.
if (!empty($updateData))
foreach ($data as $k => $entry)
{
$smcFunc['db_query']('', '
UPDATE ' . $table . '
SET ' . $updateData . '
' . (empty($where) ? '' : ' WHERE ' . $where),
$entry, $connection
);

// Make a note that the replace actually overwrote.
if (smf_db_affected_rows() != 0)
{
unset($data[$k]);
$db_replace_result = 2;
}
}
}

Code (replace) Select

// Replacing? Then, delete first, insert later.
if ($method == 'replace')
{
$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);

// A key? That's what we were looking for.
if (in_array($columnName, $keys))
$where .= (empty($where) ? '' : ' AND ') . substr($actualType, 0, -2);
$count++;
}
// Make it so.
if (!empty($where))
{
foreach ($data as $k => $entry)
{
$smcFunc['db_query']('', '
DELETE FROM ' . $table .
(empty($where) ? '' : ' WHERE ' . $where),
$entry, $connection
);
}
}
}



Also, in install.php:
Code (find) Select

'utf8_version_check' => '$request = pg_query(\'SELECT version()\'); list ($version) = pg_fetch_row($request); return $version;',

Code (replace) Select

'utf8_version_check' => '$request = pg_query(\'SELECT version()\'); list ($version) = pg_fetch_row($request); $version_array = explode(" ", $version); $version = $version_array[1]; return $version;',
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Advertisement: