commit 248750578a938a1eaa2e49004302d14ab7318c5b
Author: Matt Riedemann <email address hidden>
Date: Tue Nov 20 13:55:55 2018 -0500
Remove GROUP BY clause from CellMapping.get_by_project_id
Under postgresql, the GROUP BY clause in this query fails with:
DBError: (psycopg2.ProgrammingError) column "instance_mappings.created_at"
must appear in the GROUP BY clause or be used in an aggregate function
And we're getting lucky with using this under mysql because we don't
have the ONLY_FULL_GROUP_BY mode set (but we probably should).
This change removes the GROUP BY clause and re-writes the query
to avoid the joinedload() from the instance_mappings table and
simply do a subquery to get the cell_ids and then do a simple
IN query with the cell_mappings table. This fixes the GROUP BY
issue and should also make the query more efficient since we
won't have to load InstanceMappings ORM objects.
Reviewed: https:/ /review. openstack. org/619061 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=248750578a9 38a1eaa2e490043 02d14ab7318c5b
Committed: https:/
Submitter: Zuul
Branch: master
commit 248750578a938a1 eaa2e49004302d1 4ab7318c5b
Author: Matt Riedemann <email address hidden>
Date: Tue Nov 20 13:55:55 2018 -0500
Remove GROUP BY clause from CellMapping. get_by_ project_ id
Under postgresql, the GROUP BY clause in this query fails with:
DBError: (psycopg2. ProgrammingErro r) column "instance_ mappings. created_ at"
must appear in the GROUP BY clause or be used in an aggregate function
And we're getting lucky with using this under mysql because we don't
have the ONLY_FULL_GROUP_BY mode set (but we probably should).
This change removes the GROUP BY clause and re-writes the query
to avoid the joinedload() from the instance_mappings table and
simply do a subquery to get the cell_ids and then do a simple
IN query with the cell_mappings table. This fixes the GROUP BY
issue and should also make the query more efficient since we
won't have to load InstanceMappings ORM objects.
Change-Id: Idc9b5ad019205f 447c82a702dd339 1fa5dd20228
Closes-Bug: #1804271