When accessing User config page in admin i get a sql error
I tried to create a user, then looked at XHR request, it dumps a SQL statement, this is a issue also because it reveals SQL structure. Debug options should be hidden in production.
SELECT
user_id,
GROUP_CONCAT(name ORDER BY name SEPARATOR ", ") AS groups
FROM piwigo_user_group
JOIN `piwigo_groups` ON id = group_id
WHERE user_id IN (1,2,3)
GROUP BY user_id
AS groups => groups is a reserved keyword in mysql 8 query fails
EDIT: updated the SQL query forgot to correct as it is in piwigo files (group => groups)
When accessing User config page in admin i get a sql error
I tried to create a user, then looked at XHR request, it dumps a SQL statement, this is a issue also because it reveals SQL structure. Debug options should be hidden in production.
SELECT
user_id,
GROUP_CONCAT(name ORDER BY name SEPARATOR ", ") AS groups
FROM piwigo_user_group
JOIN `piwigo_groups` ON id = group_id
WHERE user_id IN (1,2,3)
GROUP BY user_id
```AS groups``` => groups is a reserved keyword in mysql 8 query fails
https://dev.mysql.com/doc/refman/8.0/en/keywords.html#keywords-8-0-detailed-G
GROUPS (R); added in 8.0.2 (reserved)

EDIT: updated the SQL query forgot to correct as it is in piwigo files (group => groups)
<!-- github-sync-id:506307090 -->
How can you have AS group ?!? It's AS groups in admin/user_list_backend.php (not changed in the last 6 years).
Hi @Kwaadpepper
How can you have `AS group` ?!? It's `AS groups` in `admin/user_list_backend.php` (not changed in the last 6 years).
<!-- github-comment-id:541652624 -->
Sorry i played with the query but still changing AS group to AS groups there is the same issue
changing to something random like AS groupss and it works
GROUPS (R); added in 8.0.2 (reserved)
Sorry i played with the query but still changing ```AS group``` to ```AS groups``` there is the same issue
changing to something random like ```AS groupss``` and it works
GROUPS (R); added in 8.0.2 (reserved)


<!-- github-comment-id:541853288 -->
Sorry i played with the query but still changing AS group to AS groups there is the same issue
changing to something random like AS groupss and it works
GROUPS (R); added in 8.0.2 (reserved)
I do agree with Kwaadpepper. I have the same behaviour on my environment. I changed the line 204 from "AS groups" to "AS groupss" of file "admin/user_list_backend.php" and also the line 213 from :
> Sorry i played with the query but still changing `AS group` to `AS groups` there is the same issue
> changing to something random like `AS groupss` and it works
>
> ```
> GROUPS (R); added in 8.0.2 (reserved)
> ```
>
> 
> 
I do agree with Kwaadpepper. I have the same behaviour on my environment. I changed the line 204 from "AS groups" to "AS groupss" of file "admin/user_list_backend.php" and also the line 213 from :
`$groups_of_user[ $row['user_id'] ] = $row['groups'];`
To :
`$groups_of_user[ $row['user_id'] ] = $row['groupss'];`
And it now works as a charm :) .
<!-- github-comment-id:542695444 -->
I had that issue as well after updating to Ubuntu 19.10/MySQL 8.
In my local version, I just added backticks to quote the reserved keyword,that's enough.
Now the query looks like that:
$query = '
SELECT
user_id,
GROUP_CONCAT(name ORDER BY name SEPARATOR ", ") AS `groups`
FROM '.USER_GROUP_TABLE.'
JOIN `'.GROUPS_TABLE.'` ON id = group_id
WHERE user_id IN ('.implode(',', $user_ids).')
GROUP BY user_id
;';
I had that issue as well after updating to Ubuntu 19.10/MySQL 8.
In my local version, I just added backticks to quote the reserved keyword,that's enough.
Now the query looks like that:
```
$query = '
SELECT
user_id,
GROUP_CONCAT(name ORDER BY name SEPARATOR ", ") AS `groups`
FROM '.USER_GROUP_TABLE.'
JOIN `'.GROUPS_TABLE.'` ON id = group_id
WHERE user_id IN ('.implode(',', $user_ids).')
GROUP BY user_id
;';
```
<!-- github-comment-id:549267094 -->
I fixed it in my environment like described in https://github.com/Piwigo/AMenuManager/issues/5#issuecomment-551291566
<!-- github-comment-id:551298629 -->
As for me as a workaround, I installed a lower mysql version to use with docker and using another port (docker is doing the forwarding) on a debian server.
As for me as a workaround, I installed a lower mysql version to use with docker and using another port (docker is doing the forwarding) on a debian server.
<!-- github-comment-id:551396660 -->
@plegall Did you find some time to review my pull request #1117 ?
A quite simple and straight forward solution to improve compatibility with newer MySQL/MariaDB versions.
@plegall Did you find some time to review my pull request #1117 ?
A quite simple and straight forward solution to improve compatibility with newer MySQL/MariaDB versions.
<!-- github-comment-id:555115545 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
When accessing User config page in admin i get a sql error
I tried to create a user, then looked at XHR request, it dumps a SQL statement, this is a issue also because it reveals SQL structure. Debug options should be hidden in production.
AS groups=> groups is a reserved keyword in mysql 8 query failshttps://dev.mysql.com/doc/refman/8.0/en/keywords.html#keywords-8-0-detailed-G
EDIT: updated the SQL query forgot to correct as it is in piwigo files (group => groups)
simillar issue here https://github.com/Piwigo/Piwigo/issues/919
Hi @Kwaadpepper
How can you have
AS group?!? It'sAS groupsinadmin/user_list_backend.php(not changed in the last 6 years).Sorry i played with the query but still changing
AS grouptoAS groupsthere is the same issuechanging to something random like
AS groupssand it worksI do agree with Kwaadpepper. I have the same behaviour on my environment. I changed the line 204 from "AS groups" to "AS groupss" of file "admin/user_list_backend.php" and also the line 213 from :
$groups_of_user[ $row['user_id'] ] = $row['groups'];To :
$groups_of_user[ $row['user_id'] ] = $row['groupss'];And it now works as a charm :) .
I think as it is said on the linked issue, adding quotes may be the solution, or just change alias as you say.
I had that issue as well after updating to Ubuntu 19.10/MySQL 8.
In my local version, I just added backticks to quote the reserved keyword,that's enough.
Now the query looks like that:
Just added a pull request with my proposed fix, hope that helps...
I fixed it in my environment like described in https://github.com/Piwigo/AMenuManager/issues/5#issuecomment-551291566
As for me as a workaround, I installed a lower mysql version to use with docker and using another port (docker is doing the forwarding) on a debian server.
@plegall Did you find some time to review my pull request #1117 ?
A quite simple and straight forward solution to improve compatibility with newer MySQL/MariaDB versions.