SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
[11.5.362 Pro] - Formatting issues (create table in MariaDB)

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
[11.5.362 Pro] - Formatting issues (create table in MariaDB)
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2100

Post [11.5.362 Pro] - Formatting issues (create table in MariaDB) Reply with quote
Any hints why this CREATE TABLE statement
Code:

CREATE TABLE `table_1`
(
   `table_1_tid`      int(10) NOT NULL
   ,`table_2_tid`     int(10) NOT NULL
   ,`table_4_tid`     int(10) default NULL
   ,`table_3_tid`     int(10) default NULL
   ,`column_1`        decimal(18 ,16) NOT NULL
   ,`column_2`        decimal(19 ,16) NOT NULL
   ,`column_3`        int(10) default NULL
   ,CONSTRAINT `pk_table` PRIMARY KEY (`avl_tid`)
   ,CONSTRAINT `fk_table_1$table_2` foreign KEY(`table_2_tid`) REFERENCES `kr_table_2` (`table_2_tid`)
   ,CONSTRAINT `fk_table_1$table_3` foreign KEY(`table_3_tid`) REFERENCES `table_3` (`table_3_tid`)
   ,CONSTRAINT `fk_table_1$table_4` foreign KEY(`table_4_tid`) REFERENCES `table_4` (`table_4_tid`)
)ENGINE = INNODB default CHARSET = utf8 ;


gets this awkwardly formatted
Code:

CREATE TABLE `table_1`
(
   `table_1_tid`      int(10) NOT NULL
   ,`table_2_tid`     int(10) NOT NULL
   ,`table_4_tid`     int(10) default NULL
   ,`table_3_tid`     int(10) default NULL
   ,`column_1`        decimal(18
   ,16) NOT NULL
   ,`column_2`        decimal(19
   ,16) NOT NULL
   ,`column_3`        int(10) default NULL
   ,CONSTRAINT `pk_table` PRIMARY KEY (`avl_tid`)
   ,CONSTRAINT `fk_table_1$table_2` foreign KEY(`table_2_tid` )
REFERENCES `kr_table_2` (`table_2_tid`)
 ,CONSTRAINT `fk_table_1$table_3` foreign KEY(`table_3_tid`) REFERENCES `table_3` (`table_3_tid`)
 ,CONSTRAINT `fk_table_1$table_4` foreign KEY(`table_4_tid`) REFERENCES `table_4` (`table_4_tid`)
 )ENGINE = INNODB default CHARSET = utf8;


when applying this formatting rule:
Code:

CREATE TABLE ...(
    ...
    ,...
)...;


Why are the parameters for the decimal broken into separate lines? The constraint for the foreign key is also mangled. First I though other rules might interfere, I have a rule for (...) as
Code:

(
    ...
    ,...
    AND ...
    OR ...
)


but this mutation happens even when I disable that rule.
Tue Feb 16, 2021 6:09 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7833

Post Reply with quote
This is a side effect of the Stacked (leading with indent) rule for commas, and similar rules forcing movements of commas. The text formatter doesn't differentiate commas by their "meaning". It's a known limitation. We plan on enhancing that behavior in a feature version.
Tue Feb 16, 2021 10:01 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7833

Post Reply with quote
It turns out that the previous statement actually isn't completely accurate. After a deeper review the team discovered the following formatting rule in your configuration file containts a pattern for CONSTRAINT with nested brackets, which in conjunction with stacked commas rule leads to side effects.

"create table with constraints"

Code:
CREATE TABLE ...(
    ...
    ,...
    ,CONSTRAINT ... (..., ...)
);


We are investigating what can be done to avoid such side effects.
Thu Feb 18, 2021 9:38 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.