Formatter Errors on "ALTER TABLE ... DROP INDEX" Clause

This has been a formatter issue since the syntax was introduced. I’m just on a roll today and I’m manually plugging through 50+ of these. I’m deathly afraid to touch the parser rules without explicit guidance. It generates the error message listed below on each ALTER statement with the DROP INDEX clause. It also fails to remove the extra padding after the DROP. These all come from Toad generated DDL in sync scripts and also in table rebuilds. 11.6 puts 4 spaces between DROP and INDEX with every format call. 12.1 doesn’t add the additional spaces, but generates the error and doesn’t de-space. Is there a way to kill the error messages? Does the formatter have to be changed or is there some configuration setting somewhere that would format the statements? Earlier versions stopped formatting at first sight of this syntax. At least now the other statements are formatted.

ALTER TABLE nwps.keyops DROP CONSTRAINT keyops_uk DROP INDEX;

CREATE UNIQUE INDEX nwps.keyops_uk
ON nwps.keyops (joborder_cd, coars_said, keyop_cd)
NOLOGGING
TABLESPACE nwps1_idx;

ALTER TABLE nwps.keyops ADD (
CONSTRAINT keyops_uk
UNIQUE (joborder_cd, coars_said, keyop_cd)
USING INDEX nwps.keyops_uk
ENABLE VALIDATE);

Formatter generates:

[Error] Syntax check (1: 64): ERROR line 1, col 64, ending_line 1, ending_col 68, Found ‘INDEX’, Expecting: ( COLUMN COLUMNS CONSTRAINT CONSTRAINTS PRIMARY SUPPLEMENTAL UNIQUE UNUSED

Ugh! that’s my code kicking out those extra spaces. I’ll fix that. I’m not the formatter guy though.

Oh, that wasn’t me after all.

This is a parser bug on the ALTER TABLE statement, and this causes the formatter to fail on this very statement and leaving you with the extra spaces. We’ll fix it asap (ref. QP-405).

Thanks for reporting this.

Not sure what you mean by “touch the parser rules” though, could you please explain?

I think I was smashing non-related areas. As an organization I ask the developers to take the formatter options as-is out of the box for every version, less the header tagline enabled, to minimize diffs in our version control tool. The Language Management is another shady area that I hope I never need to fully comprehend. I’m just glad it isn’t something I have to modify in either of these areas.

The QP-405 has been fixed, the fix will now find its way to the Toad drops.