From ea5f88af83a40c91741f6e7328636376ca259c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E7=BB=A7=E9=A3=8E?= <1914007838@qq.com> Date: Tue, 28 Nov 2023 17:25:15 +0800 Subject: [PATCH] [fix]Fixing the bug that causes index migration failure in multi-schema environments. --- psqlextra/backend/introspection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psqlextra/backend/introspection.py b/psqlextra/backend/introspection.py index bd775779..b008b813 100644 --- a/psqlextra/backend/introspection.py +++ b/psqlextra/backend/introspection.py @@ -231,7 +231,7 @@ def get_constraints(self, cursor, table_name: str): # standard Django implementation does not return the definition # for indexes, only for constraints, let's patch that up cursor.execute( - "SELECT indexname, indexdef FROM pg_indexes WHERE tablename = %s", + "SELECT indexname, indexdef FROM pg_indexes WHERE schemaname = current_schema() AND tablename = %s", (table_name,), ) for index_name, definition in cursor.fetchall():