Similar to sqlc-dev/sqlc#4065. When formatting a schema generated by pgdump, I receive the following error:
/node_modules/sql-formatter/dist/cjs/lexer/TokenizerEngine.js:42
return new Error(`Parse error: Unexpected "${text}" at line ${line} column ${col}.\n${this.dialectInfo()}`);
^
Error: Parse error: Unexpected "\restrict " at line 1 column 1.
SQL dialect used: "postgresql".
Usage
I use sql-formatter in a Makefile:
SQL_FORMATTER := npx --yes -- sql-formatter@15.7.0
.PHONY: format-sql
format-sql:
for f in $(SQL_SOURCES); do $(SQL_FORMATTER) --fix $$f; done