Skip to content

Sanitizing Identifiers #2295

@KeynesYouDigIt

Description

@KeynesYouDigIt

https://www.psycopg.org/docs/sql.html has this useful feature where tables, schemas, etc can be safely parametrized and added to a query.

query = sql.SQL("select {field} from {table} where {pkey} = %s").format(
    field=sql.Identifier('my_name'),
    table=sql.Identifier('some_table'),
    pkey=sql.Identifier('id'))

is this supported or on the roadmap?

I also asked the team working on https://github.com/qooleot/node-pg-query-template but I thought id mention it here as well.

https://stackoverflow.com/questions/62907228/sanitizing-user-inputs-when-the-user-input-is-a-schema-name-in-node-postgres provides a bit more background.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions