pgFormatter
pgFormatter copied to clipboard
A PostgreSQL SQL syntax beautifier that can work as a console program or as a CGI. On-line demo site at http://sqlformat.darold.net/
The structure like this: ```sql WITH hello_world AS ( WITH hello_another_world AS ( WITH hello_third_world AS ( SELECT FROM WHERE ORDER BY ), hello_third_world_again AS ( SELECT FROM WHERE ORDER...
Here is the code been formatted ```sql CREATE FUNCTION get_jobs (orgId varchar, pagesize integer, pagenum integer) RETURNS TABLE ( job_id varchar) LANGUAGE plpgsql AS $$ BEGIN RETURN QUERY WITH filtered_jobs...
Let's call this an INSELECT (instead of UPSERT): ```sql WITH i AS ( INSERT INTO users (email) VALUES ($1) ON CONFLICT DO NOTHING RETURNING *) SELECT * FROM i UNION...
When I run pg_format 5.2 on a plain SQL function, its body gets formatted weird: ``` pg_format \ --nocomment \ --spaces 2 \ --wrap-limit 80 \ hello.sql ``` ```SQL CREATE...
Good day, I will just post an example and if this looks like it could use improvement, I will file an issue correctly. If this is expected behavior, I saved...
I noticed several issues around CTEs and indentation. I.e., - #258 - #213 - #202 - #195 I don't want to pile on, but thought that an issue to track...
No idea why the indentation is off by 1 at the end of this query ``` pg_format
$ pg_format --version pg_format version 4.4 Reproduced also on [live demo page](http://sqlformat.darold.net/). Command: ``` $ pg_format --keyword-case 2 --tabs --comma-start --no-extra-line --inplace input.sql ``` Input: ``` CREATE OR REPLACE VIEW...
Much like https://github.com/darold/pgFormatter/issues/240. ``` SELECT SELECT sum(amount) FROM payments + /* keep this comment to avoid crash */ ( SELECT sum(amount) FROM payments WHERE owner_id IN ( SELECT id FROM...
Current: ```sql DROP FUNCTION IF EXISTS app_public.hello (a text); ``` Expected: ```sql DROP FUNCTION IF EXISTS app_public.hello(a text); ```