commit 25dc6a467c641ccad5cc75f1003548af4f28b4fb
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.
Change-Id: Idc9b5ad019205f447c82a702dd3391fa5dd20228
Closes-Bug: #1804271
(cherry picked from commit 248750578a938a1eaa2e49004302d14ab7318c5b)
Reviewed: https:/ /review. openstack. org/625377 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=25dc6a467c6 41ccad5cc75f100 3548af4f28b4fb
Committed: https:/
Submitter: Zuul
Branch: stable/rocky
commit 25dc6a467c641cc ad5cc75f1003548 af4f28b4fb
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 eaa2e49004302d1 4ab7318c5b)
Closes-Bug: #1804271
(cherry picked from commit 248750578a938a1