6 Replies Latest reply on Aug 3, 2020 11:00 PM by Carlos Cevallos

    Formatting issue - unwanted line break after long single-line statement. Bug?

    Philipp Salvisberg

      Dear SQLDev team,


      To reproduce the formatter result, SQLDev 20.2 needs the following config changes:

      • import these advanced and custom settings provided by the Trivadis PL/SQL & SQL Formatter Settings
      • change "Indent spaces" to 4
      • change "Max char line width" to 200
      • change "Line Breaks After Statement" to "Preserve original"


      Then the formatter produces this result:


          FUNCTION f RETURN configuration.id%TYPE IS
              l_id configuration.id%TYPE := get_config_entry_id(p_namespace, p_key, p_scope);
              IF l_id IS NULL THEN
                  l_id := insert_config_entry(p_namespace, p_key, p_scope, p_value, p_visible, p_register_zeichen, p_is_blob);
                      print('Updating existing %s entry: %s:%s:%s:%s:%s:%s:%s... ', l_type, son(l_id), son(p_namespace), son(p_key), son(p_scope), son(p_value), son(p_visible), son(p_register_zeichen));
                         SET value = p_value
                       WHERE id = l_id;
                      UPDATE configuration
                         SET value = p_value
                       WHERE id = l_id;
              END IF;
              RETURN l_id;
          END f;


      See the different formatting result of the identical UPDATE statement on line 10 and 15. There is an unwanted line break before the aliased_dml_table_expression_clause  "configuration" for the first update. The second update looks good.


      When I change the "Max char line width" to 217 or higher then the result looks as expected. Please note that the length of line 8 is 197 chars.


      It looks like this line break is inserted after processing the Arbori program. I can only assume that there is a problem with the "scope of a line" (the update statement seems to be treated as part of the previous statement).


      Can you please confirm if this is a bug? And if yes, if there is any chance that it will be fixed in the coming release?


      Thanks a lot