]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Apply fix to reflection of table comments
authorGord Thompson <gord@gordthompson.com>
Mon, 7 Oct 2024 12:31:22 +0000 (06:31 -0600)
committerGord Thompson <gord@gordthompson.com>
Tue, 8 Oct 2024 11:43:16 +0000 (05:43 -0600)
Fixes: #11961
Change-Id: Ia3e704973a17cdf5c45bb5b8127435ee562c7d15

doc/build/changelog/unreleased_20/11961.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/postgresql/base.py

diff --git a/doc/build/changelog/unreleased_20/11961.rst b/doc/build/changelog/unreleased_20/11961.rst
new file mode 100644 (file)
index 0000000..c6ffceb
--- /dev/null
@@ -0,0 +1,7 @@
+.. change::
+    :tags: bug, postgresql, reflection
+    :tickets: 11961
+
+    Fixed bug in reflection of table comments where unrelated text would be
+    returned if an entry in the pg_description table happened to share the
+    same oid (objoid) as the table being reflected.
\ No newline at end of file
index 4b9f2f01505e01478322f4587ca982178a8bb3c9..86357ccbb4417a9424ebcd8002d8c1723857bd24 100644 (file)
@@ -4689,6 +4689,8 @@ class PGDialect(default.DefaultDialect):
                     pg_catalog.pg_class.c.oid
                     == pg_catalog.pg_description.c.objoid,
                     pg_catalog.pg_description.c.objsubid == 0,
+                    pg_catalog.pg_description.c.classoid
+                    == sql.func.cast("pg_catalog.pg_class", REGCLASS),
                 ),
             )
             .where(self._pg_class_relkind_condition(relkinds))