microsoft / microsoft/vscode-pgsql

Add support for placeholders in queries (%s, %(foo)s, ? etc.)

Open
#117 8 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs-verify
Dominant language
No language data
Stars
395
Forks
33
Avg merge
1h 46m
Merged PRs (30d)
3

Description

Most Postgres connectors support placeholders in queries to be bound during execute time, such as

-- PEP-249: format
select id from products p where p.event_id = %s;

-- PEP-249: pyformat
select id from products p where p.event_id = %(event_id)s

-- PEP-249: qmark
select id from products p where p.event_id = ?

-- PEP-249: named
select id from products p where p.event_id = :event_id

-- PEP-249: numeric
select id from products p where p.event_id = :1

It would be useful if queries containing placeholders could be executed using the PGSQL: Execute PostgreSQL Query command with a way to supply parameters for placeholders, such as

  1. Ask the user for values via interactive input,
  2. Open a pane with a table of discovered placeholders and editable cells for values, or
  3. Open an editor with discovered placeholders in eg. JSON or YAML syntax

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PGSQL: Execute PostgreSQL Query command and inspect how it currently receives and executes query text. Compare the listed placeholder syntaxes and determine which parameter-entry approach should be implemented; done means a supported placeholder query can receive bound values and execute successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, vscode
Domain
databases, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.