Database error on logging in

I’m getting an SQL error on login which I’ve never seen before and I can’t find anything about it in the forum… can anyone point me in the right direction?

Error is this:

An exception occurred while executing ‘SELECT g.gName, u.uID FROM g LEFT JOIN UserGroups ug ON ug.gID=g.gID INNER JOIN Users u ON ug.uID=u.uID AND (u.uName=? OR u.uEmail=?)’ with params [“admin”, “admin”]:

SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘xxxxxxx.g’ doesn’t exist

It’s not the usual ‘Groups’ error but something else. Version is 8.5.1


Have you added any user attributes recently?

No, no user attributes… but I’m pretty sure the hosting provider has upgraded mySQL

It looks like a table is supposed to be aliased to ‘g’ in the left join. The equivalent of the aliases already in the statement
UserGroups ug
Users u

Are you using any login or group related addons or custom code on login?

Hi John
Sorry, I should have mentioned the xxxx is the database name, with .g suffix. No special user stuff, just simple login to simple site with no custom stuff.

In this SQL g is either a table name or an alias for a table name. See how UserGroups ug declares ug as an alias for UserGroups.

‘xxxxxxx.g’ means databasename.tablename. I presume you have redacted the actual database name, so that means ‘table g of the database’ or ‘table alias g of the database’

Yes, redacted the database name. So, table G must be groups then? Or an alias… do you have any idea how to fix this, bearing in mind I’ve reached the end of my knowledge of database stuff (what little knowledge there actually was)? Would a new database do the trick or is it a PHP error linked to the ‘groups’ one? thanks J

Also, the error report would also give a file/line number

It’s not showing up in the server error log and that message is all I’m getting… it’s actually not stopping me from logging in, so it’s an odd one. Is it worth dropping the table? J

Don’t drop the table. Enable the debug option, open the dev console on the network tab, then do what causes the error.

You will either get a trace in the page or a trace in the dev console doc or xhr tabs. That will identify the file and line.

Are you using any login or group related addons or custom code on login?
Are you using any login or group related addons or custom code on login?

No, nothing… just site theme and a couple of add-ons like white label, page redirect and a gallery. The only action on login is redirect to home. Not sure what I’m looking for on the dev console but I can’t see anything obvious except missing favicon?

With debug enabled, you will get a full whoops report rather than a short report of the error.
This will either be in the page or in one of the entries of the Network tab of the dev console.

Hi John. I’m not getting anything I’m afraid… debug is enabled in C5 but it’s just that message at the top… nothing in the console as far as I can see. I’m probably missing something obvious here but I just can’t see any error message I can act upon. J

I did some searching of the source on an old 8.5.1 dev site and it appears that the Groups table name was not fully escaped in 8.5.1, so would run into issues with latest mySQL.
If that is the case, you will need to update concrete to 8.5.7. (no point messing about with any intermediaries). An in-situ update by swapping the concrete folder is usually easiest for such. Disable the cache and put database entities into developer mode first. And take a backup just in case.

For future diagnostics
The settings should be like:

Also on the log settings

With both those enabled, if you don’t get more info in the page or the developer console, you will hopefully get some info in the concrete log.

Brilliant… I’ll give it a try. I was thinking an upgrade might do it… many thanks John. J

Worked a treat… thanks John!