Skip to content

mamonsu.statements_pro #222

Description

@apdma

$ mamonsu --version
mamonsu 3.5.15

В
https://github.com/postgrespro/mamonsu/blob/e6f789048e8498ca4fb9ee9901ac22f70f8acdac/mamonsu/tools/bootstrap/sql.py
есть проверка перед созданием функции
mamonsu.statements_pro()

   WITH tb_type AS (SELECT exists(SELECT * FROM pg_proc WHERE proname = 'pgpro_version'))
   SELECT
      CASE
         WHEN exists = false THEN 'vanilla' ELSE 'pro'
      END INTO pg_type
   FROM tb_type;

   <<functions_creation>>
   BEGIN
   IF pg_type = 'pro' THEN
      .......

          EXECUTE 'DROP FUNCTION IF EXISTS mamonsu.statements_pro();
                  CREATE OR REPLACE FUNCTION mamonsu.statements_pro()

Соответственно, если pg_type=vanilla - ничего не происходит, логично.

В
https://github.com/postgrespro/mamonsu/blob/e6f789048e8498ca4fb9ee9901ac22f70f8acdac/mamonsu/plugins/pgsql/statements.py

        "pgpro_stats_bootstrap":
            """
            SELECT {columns} FROM mamonsu.statements_pro();
            """

То есть без разницы какая версия - всегда будет обращение к mamonsu.statements_pro().

[DEBUG] 2026-05-22 12:43:29,494 - PGSQL-(host=/tmp/.s.PGSQL.5432 db=mamonsu_db user=mamonsu port=5432)  -       Run: "SELECT read_bytes, write_bytes, dirty_bytes, read_time, write_time, other_time, wal_bytes, wal_records, wal_fpi FROM mamonsu.statements_pro();"
[ERROR] 2026-05-22 12:43:29,495 - STATEMENTS    -       plugin statements caught error: {'S': 'ERROR', 'V': 'ERROR', 'C': '42883', 'M': 'function mamonsu.statements_pro() does not exist', 'H': 'No function matches the given name and argument types. You might need to add explicit type casts.', 'P': '131', 'F': 'parse_func.c', 'L': '636', 'R': 'ParseFuncOrColumn'}
[INFO] 2026-05-22 12:43:29,495 - STATEMENTS     -       hint: enable debug level to full exception trace
[DEBUG] 2026-05-22 12:43:29,495 - STATEMENTS    -       Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mamonsu/plugins/pgsql/driver/connection.py", line 59, in query
    cursor.execute(query)
  File "/usr/lib/python3/dist-packages/mamonsu/plugins/pgsql/driver/pg8000/core.py", line 342, in execute
    stream=stream)
  File "/usr/lib/python3/dist-packages/mamonsu/plugins/pgsql/driver/pg8000/core.py", line 1213, in execute_unnamed
    self.handle_messages(cursor)
  File "/usr/lib/python3/dist-packages/mamonsu/plugins/pgsql/driver/pg8000/core.py", line 1380, in handle_messages
    raise self.error
mamonsu.plugins.pgsql.driver.pg8000.exceptions.ProgrammingError: {'S': 'ERROR', 'V': 'ERROR', 'C': '42883', 'M': 'function mamonsu.statements_pro() does not exist', 'H': 'No function matches the given name and argument types. You might need to add explicit type casts.', 'P': '131', 'F': 'parse_func.c', 'L': '636', 'R': 'ParseFuncOrColumn'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mamonsu/lib/plugin.py", line 173, in _loop
    self.run(self.sender)
  File "/usr/lib/python3/dist-packages/mamonsu/plugins/pgsql/statements.py", line 202, in run
    self.extension].format(metrics=(", ".join(columns)), extension_schema=extension_schema))
  File "/usr/lib/python3/dist-packages/mamonsu/plugins/pgsql/driver/pool.py", line 149, in query
    return self._connections[db].query(query)
  File "/usr/lib/python3/dist-packages/mamonsu/plugins/pgsql/driver/connection.py", line 68, in query
    raise ProgrammingError(error_text)
mamonsu.plugins.pgsql.driver.pg8000.exceptions.ProgrammingError: {'S': 'ERROR', 'V': 'ERROR', 'C': '42883', 'M': 'function mamonsu.statements_pro() does not exist', 'H': 'No function matches the given name and argument types. You might need to add explicit type casts.', 'P': '131', 'F': 'parse_func.c', 'L': '636', 'R': 'ParseFuncOrColumn'}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions