Details
-
Bug
-
Status: Closed
-
TBD
-
Resolution: Duplicate
-
None
-
None
-
None
-
Undetermined
-
Description
When installing latest openmrs core (OpenMRS 2.1.0-9122a9) I get an error when it is executing changeset "20110825-1000-creating-providers-for-persons-from-encounter"
This error is thrown because the list of columns mentioned in select clause is not in the group by. The statement in question is:
select max(users.user_id) as user_id, users.system_id,
users.person_id, users.retired, users.retired_by,
users.date_retired, users.retire_reason
from users as users
group by users.person_id
The full error trace is:
Error executing SQL insert into provider(person_id, identifier, creator, date_created, retired, retired_by, date_retired, retire_reason, uuid)
select distinct person.person_id, user.system_id, 1, CURRENT_TIMESTAMP, user.retired, user.retired_by, user.date_retired, user.retire_reason, CONCAT('prov', SUBSTRING(person.uuid, 5))
from person as person
inner join encounter as encounter on encounter.provider_id = person.person_id
left join (select max(users.user_id) as user_id, users.system_id, users.person_id, users.retired, users.retired_by, users.date_retired, users.retire_reason
from users as users group by users.person_id) as user
on person.person_id = user.person_id
where user.user_id is not null and encounter.provider_id not in (select person_id from provider): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'openmrs.users.system_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by