Toad World® Forums

formatter: inconsistent indentation of column declaration definition


#1

All,

I’ve noticed the formatter is nota lways consistent in the way it indents the column declaration section of a view definition.
Here’s the sample view definition (just two columns) I’ll use to demonstrate the bahaviour:

create or replace view stock_stats.stock_stats_vw(partno, repl_qty_cost_of_sales_1yr_ext)
as select r.partno, r.repl_qty_sold_1yr + r.repl_qty_uninvoiced - r.repl_qty_returned_1yr as repl_qty_cost_of_sales_1yr_ext
from stock_stats.results r;

With the addition of an additional term in the second column’s definition this turns into:

create or replace view stock_stats.stock_stats_vw(partno, repl_qty_cost_of_sales_1yr_ext)
as select r.partno, r.repl_qty_sold_1yr + r.repl_qty_uninvoiced - r.repl_qty_returned_1yr as repl_qty_cost_of_sales_1yr_ext - r.repl_qty_uninvoiced_returns
from stock_stats.results r;

The formatter turns these two queries into the following format:

Formatter_indent_of_column_declaration.png

As you can see, in the first query the column list declaration indents after the view-name,
whereas the second query has the column list not indented at all. It goes smack into column 1.

It seems this is caused by the line overflow in the body definition, caused by the addition
of the fourth term in the calculation for the second column.

I don’t quite understand why the indent of the column declaration section should be reduced to zero
when a line overflow occurs in the body of the column definition. The indentation of the body is not reduced.

For completeness’ sake here are my formatter settings:

252 5.266.0 5.273 2 2 140 2 2 2 2 1 1 1 2 1 0 2 0 1 0 0 0 S 1 1 1 S 1 1 1 SO 1 1 S 1 S 1 1 1 S 1 1 1 S S 1 1 1 1 1 1 3 1 1 S S 1 1 S 1 1 S 1 1 1 1 SO 99 1 1 SO 1 1 1 2 0 by Toad formatter

Kind regards,
Abe Kornelis


#2

You’re right. This needs to be addressed. (QP-859)

Thanks for reporting,

Andre


#3

Fixed. Now the columns stay to the right until you decrease the right hand margin (140 in your setup) down to 80, then both lists will move to the left.

You’ll see the change in some future Toad drop featuring QP5 version 5.275 or later.