Skip to content

[Bug]: Failure in parsing correct postgresql partially duplicates output #2208

@TrapsterDK

Description

@TrapsterDK

What happened?

Failure to parse valid postgresql code, sqlfluff handles it correctly.

CREATE FUNCTION test(input_text TEXT)
RETURNS BOOLEAN AS  $$   
BEGIN
    SELECT {test};
END;
$$ LANGUAGE plpgsql IMMUTABLE STRICT; 

[sqruff]
dialect = postgres
templater=placeholder

[sqruff:templater:placeholder]
param_regex = .*?\}
1=test

Formats as

CREATE FUNCTION test(input_text TEXT)
RETURNS BOOLEAN AS $$   
BEGIN
    SELECT {test};
END;
$$ LANGUAGE plpgsql IMMUTABLE STRICT;     SELECT {test};
END;
$$ LANGUAGE plpgsql IMMUTABLE STRICT; 

Here is a play ground link with the entire setup.
https://playground.quary.dev/?secondary=Format#eNpNjl9rwjAUxb/KJfiwjTHYa6WMtMtKoabQpjBYhhS9doUaY3IFQfrdl4iID5dz/5z741yYP04sYXkjuBLw1clclbUEQk9Po7EnWhOeCZT4Vs/aadMI1TWyhayuK8El8BZgsQCAeMxEUcrYhBlaUYlcwSWi5mXcCvl51eCvuCw6Xgiwkx1CBChXq07xrBLQqqbM1fIKjMVemUei0Qw+BP3xR3fa7X612Y79hBuCFOzB0+DQa0O4t1NP6NIgG/w7TFuMGHN7S+6G5MEQYLZ3/X7tcMBzAL69fGg9a/OexvBs/geUFmPL

Version

0.34

Checked in Playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions