Both queries return the same result; I've been using the select-for-version-16-or-under query since a few versions ago. Since upgrading to version 17, it doesn't work with a database with many defined constraints. By many, I mean:
9104 rows in table_constraints
2592 rows in referential_constraints
4476 rows in key_column_usage
The original query never completes in version 17; I tried several times and always canceled it after 30 minutes. To make it work in version 17, I had to add redundant search criteria. You can understand what I mean by comparing the attached files. The original query runs in approximately 45 seconds on version 16; the version 17 query runs in approximately 68 seconds, using the same data.
I have never reported an iissue for PostgreSQL before. Ihope this is the proper way to do it.