darold / darold/pgFormatter

Create Table with "WITH" Inline Function Not Have Correct Indentation

Open
#324 0 comments 0 reactions 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

If we put the following procedure into the pgFormatter, we will see the indentation is not right: The end ")" comes to the very beginning of the line. Also the keyword "with" is not uppercased nor is highlighted.

CREATE OR REPLACE PROCEDURE test ()
LANGUAGE plpgsql
AS $$
BEGIN
CREATE temp TABLE test AS
with reg_data AS (
SELECT
buyer
FROM
reg
WHERE
status = 'Enabled'
)
SELECT
buyer
FROM
reg_data;

END;
$$

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

Use the supplied PL/pgSQL procedure as the reproduction case. Trace how pgFormatter handles CREATE TEMP TABLE ... AS followed by a WITH CTE, then verify that the closing parenthesis is indented correctly and that WITH is uppercased and highlighted.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.