Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: shapeshifter on May 13, 2016, 04:51:13 PM

Title: "Updated Topics" error
Post by: shapeshifter on May 13, 2016, 04:51:13 PM
I'm getting the same error now. It's also an upgrade and the "unwatched" column is in the database. Anyone have any ideas? TIA

Database Error
Unknown column 'lt.unwatched' in 'where clause'
File: .../forum/Sources/Recent.php
Line: 891

Split from year old topic and error code pasted into this message from that topic.  Please avoid raising old topics in high traffic boards like this one in the future - Iris.
Title: Re: "Updated Topics" error
Post by: live627 on May 13, 2016, 07:40:53 PM
This was fixed ages ago.
Title: Re: "Updated Topics" error
Post by: shapeshifter on May 14, 2016, 09:57:43 AM
Quote from: live627 on May 13, 2016, 07:40:53 PM
This was fixed ages ago.

Umm, maybe, but not for me. I'm using the latest version, 2.1 beta 2, and I assure you I'm not imagining it.
Title: Re: "Updated Topics" error
Post by: Kindred on May 14, 2016, 10:40:40 AM
What do YOU mean by "latest" version?

Because the beta2 from our diwnload site is now outdated... the latest version, on github is almost ready for beta3
Title: Re: "Updated Topics" error
Post by: shapeshifter on May 14, 2016, 11:05:42 AM
Quote from: Kindred on May 14, 2016, 10:40:40 AM
What do YOU mean by "latest" version?

Because the beta2 from our diwnload site is now outdated... the latest version, on github is almost ready for beta3

So...if I install the latest update from the github site, it will fix the issue? Maybe it would have been better for me, and saved us all time, if someone had just helpfully told me that you need to get the latest development update from github to fix the problem.
Title: Re: "Updated Topics" error
Post by: shapeshifter on May 14, 2016, 11:17:18 AM
And for the record, the latest github download did not fix the issue. So... I guess I'll just wait till beta 3 is actually finished, which will hopefully resolve it.
Title: Re: "Updated Topics" error
Post by: Suki on May 14, 2016, 11:30:46 AM
DB related errors cannot be solved by just uploading a fresh set of files, you need to either run the upgrade process again or manually add/remove the DB column. Yes, this is why we don't encourage installing a beta on your production forum.
Title: Re: "Updated Topics" error
Post by: shapeshifter on May 14, 2016, 11:34:51 AM
Quote from: Suki on May 14, 2016, 11:30:46 AM
DB related errors cannot be solved by just uploading a fresh set of files, you need to either run the upgrade process again or manually add/remove the DB column. Yes, this is why we don't encourage installing a beta on your production forum.


I just ran the upgrade process again, and the problem remains. And the DB columns are all there, so I'm not sure what I'd need to change. And I'm not using it on a live site. But thank you for not treating me like an enemy combatant. :)
Title: Re: "Updated Topics" error
Post by: qc on May 14, 2016, 11:36:55 AM
@shapeshifter

I found that the 'unwatched' column is added by 'other/upgrade_2-1_mysql.sql' - perhaps you could try running 'other/upgrade.php' and see if that fixes this issue for you - if not, you could try to manually run the SQL file (e.g. use phpmyadmin or similar tools after making a backup).

PS: Why am the first one actually addressing the issue instead of putting blame on @shapeshifter, whose only mistake is trusting the SMF download section being up to date? :(
Title: Re: "Updated Topics" error
Post by: Suki on May 14, 2016, 11:40:06 AM
Quote from: qc on May 14, 2016, 11:36:55 AM

PS: Why am the first one actually addressing the issue instead of putting blame on @shapeshifter, whose only mistake is trusting the SMF download section being up to date? :(

No one is putting any blame on anyone.  I already adressed the issue.
Title: Re: "Updated Topics" error
Post by: shapeshifter on May 14, 2016, 11:54:28 AM
Quote from: qc on May 14, 2016, 11:36:55 AM
@shapeshifter

I found that the 'unwatched' column is added by 'other/upgrade_2-1_mysql.sql' - perhaps you could try running 'other/upgrade.php' and see if that fixes this issue for you - if not, you could try to manually run the SQL file (e.g. use phpmyadmin or similar tools after making a backup).

PS: Why am the first one actually addressing the issue instead of putting blame on @shapeshifter, whose only mistake is trusting the SMF download section being up to date? :(

This is what the current db structure looks like now, if anyone notices anything amiss feel free to point it out:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2Fwj9AYCT.png&hash=adb593b75e27509175e47510e9fc191d62cf3fd3)

But thanks, qc. Maybe I'll try a new install later and see how it goes. I suspect it might not be a problem if I did a completely new install, but I upgraded an old 2.0 forum with existing database and I'm guessing that's at the root of the problem, somehow.
Title: Re: "Updated Topics" error
Post by: Suki on May 14, 2016, 11:55:21 AM
Quote from: shapeshifter on May 14, 2016, 11:34:51 AM
Quote from: Suki on May 14, 2016, 11:30:46 AM
DB related errors cannot be solved by just uploading a fresh set of files, you need to either run the upgrade process again or manually add/remove the DB column. Yes, this is why we don't encourage installing a beta on your production forum.


I just ran the upgrade process again, and the problem remains. And the DB columns are all there, so I'm not sure what I'd need to change. And I'm not using it on a live site. But thank you for not treating me like an enemy combatant. :)


Run this on your hosting's phpmyadmin or similar:

ALTER TABLE {$db_prefix}log_topics
ADD COLUMN unwatched TINYINT(3) NOT NULL DEFAULT '0';

UPDATE {$db_prefix}log_topics
SET unwatched = 0;

replace {db_prefix} with the actual prefix of your tables.
Title: Re: "Updated Topics" error
Post by: qc on May 14, 2016, 12:15:14 PM
@shapeshifter Is that the structure of the log_topics table? If yes, is the error message you are now getting exactly as stated in your initial posting?
Title: Re: "Updated Topics" error
Post by: shapeshifter on May 14, 2016, 12:19:05 PM
Quote from: Suki on May 14, 2016, 11:55:21 AM
Quote from: shapeshifter on May 14, 2016, 11:34:51 AM
Quote from: Suki on May 14, 2016, 11:30:46 AM
DB related errors cannot be solved by just uploading a fresh set of files, you need to either run the upgrade process again or manually add/remove the DB column. Yes, this is why we don't encourage installing a beta on your production forum.


I just ran the upgrade process again, and the problem remains. And the DB columns are all there, so I'm not sure what I'd need to change. And I'm not using it on a live site. But thank you for not treating me like an enemy combatant. :)


Run this on your hosting's phpmyadmin or similar:

ALTER TABLE {$db_prefix}log_topics
ADD COLUMN unwatched TINYINT(3) NOT NULL DEFAULT '0';

UPDATE {$db_prefix}log_topics
SET unwatched = 0;

replace {db_prefix} with the actual prefix of your tables.

Okay, I'm guessing by the error I got that I maybe picked a wrong server db option during the initial upgrade, because I'm seeing this:

Quote#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '{$db_smf}log_topics
ADD COLUMN unwatched TINYINT(3) NOT NULL DEFAULT '0'' at line 1

I don't know anything about MariaDB, so I confess the fault may have been entirely mine. I'll have to see about a complete redo when I get the time. Thank you
Title: Re: "Updated Topics" error
Post by: shapeshifter on May 14, 2016, 12:22:19 PM
Quote from: qc on May 14, 2016, 12:15:14 PM
@shapeshifter Is that the structure of the log_topics table? If yes, is the error message you are now getting exactly as stated in your initial posting?

Yes, and the exact error is:

Database Error
Unknown column 'lt.unwatched' in 'where clause'
File: /home/..../public_html/forum/Sources/Recent.php
Line: 891

But see my last post above. I may have upgraded incorrectly. I make no claims to being very bright when it comes to all this db stuff. ;)
Title: Re: "Updated Topics" error
Post by: qc on May 14, 2016, 12:42:49 PM
@shapeshifter You need to replace {$db_prefix} in the code Suki gave you with the correct database prefix, i.e. {$db_prefix}log_topics must be replaced with the correct / full name of the log_topics table in your database.

It seems that right now, you just replaced it with {$db_smf} ? Perhaps your database prefix is not set up correctly in your Settings.php?
Title: Re: "Updated Topics" error
Post by: shapeshifter on May 14, 2016, 01:03:43 PM
Quote from: qc on May 14, 2016, 12:42:49 PM
@shapeshifter You need to replace {$db_prefix} in the code Suki gave you with the correct database prefix, i.e. {$db_prefix}log_topics must be replaced with the correct / full name of the log_topics table in your database.

It seems that right now, you just replaced it with {$db_smf} ? Perhaps your database prefix is not set up correctly in your Settings.php?

I actually tried every combination I could think of, just because I didn't count on myself to know what I was doing, but every one resulted in an error. The table is named "smf_log_topics." Would you mind writing out the query for more me just so that I know it's idiot-proof? If I copy and paste it and it still doesn't work, at least I'll know I'm not going crazy.
Title: Re: "Updated Topics" error
Post by: qc on May 14, 2016, 01:13:23 PM
Well, if you execute the following SQL query...
ALTER TABLE smf_log_topics
ADD COLUMN unwatched TINYINT(3) NOT NULL DEFAULT '0';
...you might get an error, because you already seem to have that "unwatched" column in your smf_log_topics table.

But if you execute...
UPDATE smf_log_topics
SET unwatched = 0;
...you should not get any error, right?

Can you confirm that the Settings.php in your forum root folder contains the following entry? $db_prefix = 'smf_';
Title: Re: "Updated Topics" error
Post by: shapeshifter on May 14, 2016, 01:22:08 PM
Quote from: qc on May 14, 2016, 01:13:23 PM
Well, if you execute the following SQL query...
ALTER TABLE smf_log_topics
ADD COLUMN unwatched TINYINT(3) NOT NULL DEFAULT '0';
...you might get an error, because you already seem to have that "unwatched" column in your smf_log_topics table.

But if you execute...
UPDATE smf_log_topics
SET unwatched = 0;
...you should not get any error, right?

Can you confirm that the Settings.php in your forum root folder contains the following entry? $db_prefix = 'smf_';

Okay, believe it or not, I'd just figured it out before you replied, but thank you. I was thinking I had to include the brackets in the command, rather than realizing they were basically just a parenthetical reference. Doh. Anyway, you are correct, I did get a duplicate column error. I tried your command and it executed but it didn't fix the problem, unfortunately. And yes, I can confirm that Settings.php has the correct entry: $db_prefix = 'smf_'; (That's a copy and paste from the file.)
Title: Re: "Updated Topics" error
Post by: qc on May 14, 2016, 02:31:43 PM
It seems your database is correct.

* Are you using the correct database in your Settings.php or perhaps pointing to another, older one?
* Did you download the most up-to-date code from https://github.com/SimpleMachines/SMF2.1/archive/release-2.1.zip (note that it is the release-2.1 branch, not master or development)?
Title: Re: "Updated Topics" error
Post by: shapeshifter on May 14, 2016, 06:56:22 PM
Yes, it's the correct database in settings.php, and that release is the one I used to update this morning. Thanks
Title: Re: "Updated Topics" error
Post by: qc on May 14, 2016, 07:47:52 PM
Ok, so if nobody else has a better idea, I would suggest you to do the following:
Title: Re: "Updated Topics" error
Post by: shapeshifter on May 14, 2016, 08:02:00 PM
I found it on line 913 and added your code before it and got this as soon as I clicked "Unread Posts":

mysqli_result Object ( [current_field] => 0 [field_count] => 2 [lengths] => [num_rows] => 1 [type] => 0 )
Title: Re: "Updated Topics" error
Post by: qc on May 14, 2016, 08:05:20 PM
Quote from: shapeshifter on May 14, 2016, 08:02:00 PM
I found it on line 913
Ah, would you mind posting lines 891 to 913 of your Recent.php here then? You seem to have another version of that file than at github ( https://github.com/SimpleMachines/SMF2.1/blob/release-2.1/Sources/Recent.php#L891 )!
Title: Re: "Updated Topics" error
Post by: shapeshifter on May 14, 2016, 08:17:00 PM
Quote from: qc on May 14, 2016, 08:05:20 PM
Quote from: shapeshifter on May 14, 2016, 08:02:00 PM
I found it on line 913
Ah, would you mind posting lines 891 to 913 of your Recent.php here then? You seem to have another version of that file than at github ( https://github.com/SimpleMachines/SMF2.1/blob/release-2.1/Sources/Recent.php#L891 )!

Well, I definitely did download the zip from github and upgraded, got the upgrade menu and went through the usual steps, so I'm not sure why that file wouldn't have been updated. This is the page I got it from, in case there's another I missed somewhere:

https://github.com/SimpleMachines/SMF2.1

But good news! It's fixed! All I needed was for you to point out that something was off with the lines and to see that page you linked to, copied it over to my own recent.php file and now everything works. Wow! Thanks so much for your patience and going back and forth with me on this all day. It's very much appreciated.
Title: Re: "Updated Topics" error
Post by: qc on May 14, 2016, 08:28:09 PM
Better make sure all your files are really updated to the newest version at github - https://github.com/SimpleMachines/SMF2.1/archive/release-2.1.zip

At least you thoroughly tested the SMF 2.1 database upgrade process today ;)
Title: Re: "Updated Topics" error
Post by: shapeshifter on May 14, 2016, 11:04:36 PM
I've actually deleted the contents of the entire directory at least twice today, did a full install with 2.1 beta 2 and then upgraded with the github package each time. I'm not sure how any file couldn't have been overwritten/updated already - which is why it didn't occur to me that the recent.php file might not be the correct one. Bit of a mystery. But I guess that means you're right, I should maybe do it one more time, just in case.  O:)

Thanks again!
Title: Re: "Updated Topics" error
Post by: Kindred on May 15, 2016, 05:36:35 PM
no no no no no....   that won't work


that's why we say don't use the beta unless you know what you are doing.

You can not upgrade between beta versions

You need to either do a clean install of the NEWEST beta from github -- or do an upgrade from 2.0.x
there is no upgrade path from beta to beta
Title: Re: "Updated Topics" error
Post by: Illori on May 15, 2016, 06:36:07 PM
Quote from: Kindred on May 15, 2016, 05:36:35 PM
You can not upgrade between beta versions

You need to either do a clean install of the NEWEST beta from github -- or do an upgrade from 2.0.x
there is no upgrade path from beta to beta

yes there is an upgrade path from beta to beta, you can still upgrade from a beta to another beta. this was discussed but has not changed in behavior. bugs that have been reported on the upgrade process from a beta to a beta are still being fixed.
Title: Re: "Updated Topics" error
Post by: Kindred on May 15, 2016, 08:01:48 PM
I was told very clearly that there was no and would be no database update script for beta to beta...   
Title: Re: "Updated Topics" error
Post by: Illori on May 15, 2016, 08:28:04 PM
well it seems to be working and related bugs are still being fixed. the person that made that decision did not let others know that may or may not be on the dev team.