 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
[11.5.362 Pro] - Formatting issues (create table in MariaDB) |
|
Any hints why this CREATE TABLE statement
 |
 |
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
 |
 |
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:
 |
 |
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
 |
 |
(
...
,...
AND ...
OR ...
)
|
but this mutation happens even when I disable that rule.
|
|
Tue Feb 16, 2021 6:09 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
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 |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
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"
 |
 |
CREATE TABLE ...(
...
,...
,CONSTRAINT ... (..., ...)
); |
We are investigating what can be done to avoid such side effects.
|
|
Thu Feb 18, 2021 9:38 am |
|
 |
|
|
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
|
|
|