alex-hhh/emacs-sql-indent

Unexpected indentation of "on conflict"

Closed this issue · 2 comments

Indented version:

INSERT INTO tbl (col1, col2)
VALUES (1, 2)
  ON CONFLICT (col1) DO
  UPDATE SET col2 = EXCLUDED.col2

Expected (line 3 and 4 on the same level as values:

INSERT INTO tbl (col1, col2)
VALUES (1, 2)
ON CONFLICT (col1) DO
UPDATE SET col2 = EXCLUDED.col2

syntax of line 3 and 4: (((in-insert-clause "values") . 52) (statement-continuation . 1))

I use sqlind-setup-style-left style in my configuration.

This works as expected, the sqlind-setup-style-left indentation style is configured to indent lines inside an insert clause by "one step" (a sqind-basic-offset). This is the in-insert-clause syntax symbol.

To make it indent the way you want, you will need to write your own indentation style -- you can copy sqlind-indentation-left-offsets-alist and replace the + with a 0 in the in-insert-clause list. You can find more information about customizing the indentation in the sql-indent.org manual

Ok. Thanks. I'll try to make a custom style.