darold / darold/pgFormatter

Ability to work in streaming mode

Open
#333 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PLpgSQL
Stars
2k
Forks
121
Avg merge
4d 21h
Merged PRs (30d)
7

Description

The binary always waits for the STDIN to be closed and than formats all supplied sql:

$  pg_format -
select * from companies;
select * from companies;
Ctrl+D
SELECT
    *
FROM
    companies;

SELECT
    *
FROM
    companies;

This restricts the ability to work in streaming mode.
Is it possible to format one SQL statement as long as it finishes (e.g. by ;)?
cat can be used as example as it triggers output on each line break

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

Begin with the pg_format command's stdin handling and formatter entry point; no file or test is named in the issue. Reproduce the two-statement input shown, then verify output is emitted after each semicolon without waiting for EOF while preserving the existing formatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, sql
Domain
cli, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.