Rename SQL alias groups to g to avoid reserved keyword in MySQL

Affects issues:
- Fixes #3048
This commit is contained in:
Aurora Lahtela 2023-07-21 19:18:19 +03:00
parent ffae323fe9
commit a076d16dbf

View File

@ -51,8 +51,8 @@ public class ExtensionUserIdsInGroupQuery extends QueryStatement<Set<Integer>> {
private static String buildSQL(@Untrusted Collection<String> inGroups) {
return SELECT + DISTINCT + "u." + UsersTable.ID +
FROM + ExtensionGroupsTable.TABLE_NAME + " groups" +
INNER_JOIN + UsersTable.TABLE_NAME + " u on u." + UsersTable.USER_UUID + "=groups." + ExtensionGroupsTable.USER_UUID +
FROM + ExtensionGroupsTable.TABLE_NAME + " g" +
INNER_JOIN + UsersTable.TABLE_NAME + " u on u." + UsersTable.USER_UUID + "=g." + ExtensionGroupsTable.USER_UUID +
WHERE + ExtensionGroupsTable.PROVIDER_ID + "=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID +
AND + ExtensionGroupsTable.GROUP_NAME + " IN (" + nParameters(inGroups.size()) + ")";
}