Skip to content

passing a list\set as an argument failing #511

Open
@CodyDeGhetto

Description

@CodyDeGhetto
  • asyncpg version:19.0
  • PostgreSQL version:12
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    :N\A
  • Python version:3.7.5
  • Platform:Windows
  • Do you use pgbouncer?:No
  • Did you install asyncpg with pip?:Yes
  • If you built asyncpg locally, which version of Cython did you use?:N\A
  • Can the issue be reproduced under both asyncio and
    uvloop?
    :

Similar to issue #94

I am trying to set up a query using ($1) and passing an argument. I am running into an issue when trying to pass a list of sets. Is there a way to format this query like the last example?

query = [(0,0), (1,1), (2,2)]

works:    await conn.fetch('SELECT * FROM table WHERE (a, b) IN ((0,0), (1,1), (2,2))')

works:    await conn.fetch('SELECT * FROM table WHERE (a, b) IN ' + str(tuple(query)))

fails:    await conn.fetch('SELECT * FROM table WHERE (a, b) IN ($1)', '((0,0), (1,1), (2,2))')

fails:    await conn.fetch('SELECT * FROM table WHERE (a, b) IN ($1)', str(tuple(query)))

works:    await conn.fetch('INSERT INTO table (a, b, c, d) VALUES ($1, $2, $3, $4)', a, b, c, d)

Thank you

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