SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
[11.3.279 Pro] - Formatting anomaly (MariaDB)

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
[11.3.279 Pro] - Formatting anomaly (MariaDB)
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post [11.3.279 Pro] - Formatting anomaly (MariaDB) Reply with quote
I've got the following tables for example:

Code:

CREATE TABLE `table_with_arbitrarily_long_name`(
    `id` int
   ,`column_1` int
   ,`column_2` int
   ,`column_3` int);

CREATE TABLE `another_table_with_arbitrarily_long_name`(
    `id` int
   ,`id_a` int
   ,`column_1` int
   ,`column_2` int
   ,`column_3` int);     


Using those two tables and the formatting rule for SELECT statements
Code:

SELECT ... AS ...
      ,... = ...
    INTO ...
        ,...
    FROM ... AS ...
        ,...
         JOIN ...
                ON  ... = ...
                AND ...
    WHERE ... = ...
        AND ...
        OR  ...
    GROUP BY ...
            ,...
    HAVING ...
          ,...
    ORDER BY ...
            ,...
    LIMIT ...;

I formatted this statement below:
Code:

SELECT a.`column_1` AS c1, a.`column_2` AS c2, a.`column_3` AS c3
FROM `table_with_arbitrarily_long_name` AS a INNER JOIN `another_table_with_arbitrarily_long_name` AS b ON  b.`id_a` = a.`id`;


The result was exactly as expected, the different parts of the statement, including the aliases aligned properly.
Code:

SELECT a.`column_1`                                             AS c1
      ,a.`column_2`                                             AS c2
      ,a.`column_3`                                             AS c3
    FROM `table_with_arbitrarily_long_name`                     AS a
         INNER JOIN `another_table_with_arbitrarily_long_name`  AS b
                ON  b.`id_a` = a.`id`;


But when I throw an additional INTO part into the party (puntended), the alias alignment suddenly falls apart and this
Code:

SELECT a.`column_1` AS c1, a.`column_2` AS c2, a.`column_3` AS c3
INTO @a ,@b ,@c
FROM `table_with_arbitrarily_long_name` AS a INNER JOIN `another_table_with_arbitrarily_long_name` AS b ON  b.`id_a` = a.`id`;

becomes this
Code:

SELECT a.`column_1`  AS c1
      ,a.`column_2`  AS c2
      ,a.`column_3`  AS c3
    INTO @a
        ,@b
        ,@c
    FROM `table_with_arbitrarily_long_name` AS a
         INNER JOIN `another_table_with_arbitrarily_long_name` AS b
                ON  b.`id_a` = a.`id`;


The aliases for the columns are still aligned, though only among themselves. Furthermore, they are unnecessary anyway and can be removed. But the aliases for the tables no longer align, neither with the aliases for the columns, nor with each other.
Thu Sep 24, 2020 8:48 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
Do you have separate formatting rules for INTO or INSERT INTO or something similar? Is INTO clause referenced in the formatting rule for SELECT? It looks like the formatter assumes based on the keyword pattern that there are 2 statements not one, that INTO clause is part of a next statement.
Sun Sep 27, 2020 8:53 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
No, I haven't got any formatting rules for INTO and the one for INSERT is very simple (without including keyword INTO):
Code:

INSERT ...(..., ...)


The INTO clause is indeed referenced in the formatting rule for SELECT (see code example #2 line 3 in the first post). Furthermore, as all the lines below the SELECT statement are indented as the formatting rule says they should be. I guess if SA thought INTO was a separate statement, it would be at the same indentation level as the SELECT statement was.
Sun Sep 27, 2020 4:53 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
I'm sorry I'm unable to suggest how to fix that. I've tried a couple of things but they unfortunately don't help. I'm going to log support case to get some assistance with this issue.
Mon Sep 28, 2020 2:05 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.