|
281 | 281 | - Information about replication subscriptions (available for PostgreSQL 10 and higher)
|
282 | 282 | U(https://www.postgresql.org/docs/current/logical-replication-subscription.html).
|
283 | 283 | - Content depends on PostgreSQL server version.
|
| 284 | + - The return values for the superuser and the normal user may differ |
| 285 | + U(https://www.postgresql.org/docs/current/catalog-pg-subscription.html). |
284 | 286 | returned: if configured
|
285 | 287 | type: dict
|
286 | 288 | sample:
|
@@ -679,12 +681,19 @@ def get_pub_info(self):
|
679 | 681 |
|
680 | 682 | def get_subscr_info(self):
|
681 | 683 | """Get subscription statistics."""
|
682 |
| - query = ("SELECT s.*, r.rolname AS ownername, d.datname AS dbname " |
| 684 | + columns_sub_table = ("SELECT column_name " |
| 685 | + "FROM information_schema.columns " |
| 686 | + "WHERE table_schema = 'pg_catalog' " |
| 687 | + "AND table_name = 'pg_subscription'") |
| 688 | + columns_result = self.__exec_sql(columns_sub_table) |
| 689 | + columns = ", ".join(["s.%s" % column[0] for column in columns_result]) |
| 690 | + |
| 691 | + query = ("SELECT %s, r.rolname AS ownername, d.datname AS dbname " |
683 | 692 | "FROM pg_catalog.pg_subscription s "
|
684 | 693 | "JOIN pg_catalog.pg_database d "
|
685 | 694 | "ON s.subdbid = d.oid "
|
686 | 695 | "JOIN pg_catalog.pg_roles AS r "
|
687 |
| - "ON s.subowner = r.oid") |
| 696 | + "ON s.subowner = r.oid" % columns) |
688 | 697 |
|
689 | 698 | result = self.__exec_sql(query)
|
690 | 699 |
|
|
0 commit comments