Skip to content

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

Open
@shuai93

Description

@shuai93

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:[email protected]: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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions