TaoK / PoorMansTSqlFormatter

A small free .Net and JS library (with demo UI, command-line bulk formatter, SSMS/VS add-in, notepad++ plugin, winmerge plugin, and demo webpage) for reformatting and coloring T-SQL code to the user's preferences.
http://www.architectshack.com/PoorMansTSqlFormatter.ashx
GNU Affero General Public License v3.0
969 stars 268 forks source link

Formatting add a space before []-brackets #240

Open ricflams opened 5 years ago

ricflams commented 5 years ago

I'm working with a PL/SQL middle-layer that supports using brackets for textually building any part of the SQL statement prior to executing it. This functionality is relied upon by the majority of our queries, I'd say.

An example would be:

select * from table_[some_id]

For e.g. parameter some_id=1234, the resulting PL/SQL would become select * from table_1234.

The problem:

Reformatting will add a space ahead of the left bracket: select * from table_ [some_id].

To reproduce: http://poorsql.com/?inputString=select+*+from+table_%5Bsome_id%5D

This is the single impediment for us fully using the nice formatter. I'm honestly not all that familiar with all kinds of SQL-syntaxes, but always adding a space before the bracket does seem rather gratuitous since a space could, if so desired, just be added explicitly.