MagicStack / MagicStack/asyncpg

asyncpg.exceptions.UndefinedFunctionError: function pg_listening_channels() does not exist

未关闭
#394 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

need more info
主要语言
Python
星标
8.1k
派生
468
PR 合并指标
30 天内没有已合并 PR

描述

this is error message

Traceback (most recent call last):
  File "/home/gt/workspace/algo_syncer/base/async_pg.py", line 81, in <module>
    loop.run_until_complete(run_query('SELECT 1'))
  File "/usr/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete
    return future.result()
  File "/home/gt/workspace/algo_syncer/base/async_pg.py", line 65, in run_query
    await pool.release(con)
  File "/home/gt/.local/lib/python3.6/site-packages/asyncpg/pool.py", line 643, in release
    return await asyncio.shield(ch.release(timeout), loop=self._loop)
  File "/home/gt/.local/lib/python3.6/site-packages/asyncpg/pool.py", line 214, in release
    raise ex
  File "/home/gt/.local/lib/python3.6/site-packages/asyncpg/pool.py", line 204, in release
    await self._con.reset(timeout=budget)
  File "/home/gt/.local/lib/python3.6/site-packages/asyncpg/connection.py", line 1115, in reset
    await self.execute(reset_query, timeout=timeout)
  File "/home/gt/.local/lib/python3.6/site-packages/asyncpg/connection.py", line 273, in execute
    return await self._protocol.query(query, timeout)
  File "asyncpg/protocol/protocol.pyx", line 316, in query
asyncpg.exceptions.UndefinedFunctionError: function pg_listening_channels() does not exist
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

and this is my python3.6 code

import asyncpg
import asyncio
import traceback


dsn  = 'postgres://gpadmin:gpadmin@172.16.16.134:2345/algo'

async def run_query(query):

    pool = await asyncpg.create_pool(dsn, command_timeout=60)
    con = await pool.acquire()

    try:
        if query.startswith('delete from') or query.startswith('insert'):
            result = await con.execute(query)
        else:
            result = await con.fetchval(query)
    except:
        print('Could not complete query "{}"'.format(query))
        print(traceback.format_exc())
        result = None
        exit(1)
    finally:
        await pool.release(con)
    return result


if __name__ == '__main__':
    
    loop = asyncio.get_event_loop()
    loop.run_until_complete(run_query('SELECT 1'))


Please tell me what can i do next

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 asyncpg/pool.py:204-214 和 connection.py:1115 中的 traceback 开始,然后针对报告的 PostgreSQL 兼容服务器重现 SELECT 1 示例。完成的标准是确定 pg_listening_channels() 为什么在释放 pool 期间不可用,并确定一个 repository 级别的修复方案或记录在案的兼容性限制;issue 未指定任何 repository 测试或目标文件。

由索引模型根据 Issue 内容生成。

评估

技术栈
postgresql, python
领域
databases
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。