From 7f702af482b6b47f2fe74a8b475fb2a23cb5f7a4 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Thu, 11 Jul 2024 05:58:14 +0000 Subject: [PATCH] Change the ``StandardAttribute`` load method to "selectin" This load method will remove the ``StandardAttribute`` load from the resource main query and PostgreSQL won't require it to be in the GROUP BY clause. Closes-Bug: #2072567 Change-Id: I17a455e19c4bbbc45e26dee88849ab5e0b4b5d65 --- neutron_lib/db/standard_attr.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/neutron_lib/db/standard_attr.py b/neutron_lib/db/standard_attr.py index 77843065c..88fcd396c 100644 --- a/neutron_lib/db/standard_attr.py +++ b/neutron_lib/db/standard_attr.py @@ -152,8 +152,11 @@ class HasStandardAttributes(object): # pylint: disable=method-hidden @declarative.declared_attr def standard_attr(cls): + # NOTE(ralonsoh): the load method has been updated from "joined" to + # "selectin". The first provides more complex queries but it is only + # needed one query. This is needed by PostgreSQL (LP#2072567). return sa.orm.relationship(StandardAttribute, - lazy='joined', + lazy='selectin', cascade='all, delete-orphan', single_parent=True, uselist=False)