-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error NC29 #193
Comments
I have the same problem, but I'm trying to access a view in a different mysql database (dbname=xxx_admidio) on the same server. I did a little debugging and it seems that even though the user_sql passes in the correct dbname in the $parameters to the $connectionFactory->getConnection call in lib/Query/DataQuery.php, the connection is created to the default nextcloud database... If I add the following code after the getConnection call:
The log output is: |
After some more debugging, I seem to understand how the problem appeared: Apparently PrimaryReadReplicaConnection uses a different array structure for its arguments (connection params are stored in the ['primary'] sub-array instead of first-level array elements). Unfortunately, the code in ConnectionFactory::getConnection (https://github.com/nextcloud/server/blob/147426c3ca7183ad065293bd9b600e10adde4abf/lib/private/DB/ConnectionFactory.php#L129) merges in the connection parameters as first-level arguments (as was required for the old Connection class) rather than into the ['primary'] sub-array, which is now needed for the PrimaryReadReplicaConnection. So, while the old code needed
the new Primary ReadReplicaConnection now needs them in the primary sub-array:
For a difference of the params, I found this nice page: Without that page, I would still be debugging... I suppose the correct fix would be to properly fix the ConnectionFactory to override the primary connection data instead of merging the params at top-level, where they are never used. I'll try to submit a issue with the nextcloud server repo. |
As a quick fix (ONLY for NC29!!!), one can adjust the user_sql code with the following patch:
However, this (1) depends on the specific Nextcloud Server version, (2) brings in the logic from the underlying ConnectionFactory implementation to third-party apps (i.e. it's not transparent) for no good reason and (3) might break at any time the nextcloud server chooses to fix this issue. |
Signed-off-by: Julius Härtl <[email protected]>
Positiv: I tried your small patch - it works in NC-29. |
Where / at which file did you do your changes? |
The changes are in the fork from rotdrop. Not Master but cafevdb/stable 29 The Changes are made in "lib/Query/DataQuery.php" The git is out of date - is there someone who can implement the changes to this version? KR |
Any news on this? While the patches shown above allow at least to login again. Groups are not working for me with NC29 |
Hey @RealKoenisch, what is the state with this issue (see last comment) and this app in general. For some time now we can not use our nextcloud instance. |
It seems that "Nextcloud Hub 8 (29.0.7)" switched back to the old param structure, so the workaround from April 29 is no longer needed (and indeed breaks user_sql). I switched back to the original user_sql code and it seems to work for now. |
Seems to be fixed by 5654799. Can someone comfirm? |
{"reqId":"wwrjPQE2Tzll6lg4zzJD","level":3,"time":"2024-04-24T19:20:38+00:00","remoteAddr":"94.219.34.169","user":"XXXX","app":"user_sql","method":"GET","url":"/settings/admin/logging","message":"Could not execute the query: SELECT COUNT(u.username) AS count FROM aase6_users u WHERE u.username LIKE :search ","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36","version":"29.0.0.19","exception":{"Exception":"Doctrine\DBAL\Exception\TableNotFoundException","Message":"An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'owncloud.aase6_users' doesn't exist","Code":1146,"Trace":
The table is aase6_user. Ther could be something wrong with the parameters or binding of parameter (in PDO/Statment.php passing $params to statement is depreceated.
The text was updated successfully, but these errors were encountered: