SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
[11.5.361 Pro] - Formatting issue (CREATE INDEX -SQL Server)

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
[11.5.361 Pro] - Formatting issue (CREATE INDEX -SQL Server)
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2100

Post [11.5.361 Pro] - Formatting issue (CREATE INDEX -SQL Server) Reply with quote
I've got a formatting rule for CREATE INDEX statements as following:
Code:

CREATE ... INDEX ...
    ON ... (... ,...)
    INCLUDE (..., ...)
    WHERE ...
        AND ...;


and an actual statement creating an index:

Code:

CREATE NONCLUSTERED INDEX [ix_view_jaratok____export_xml]
ON [dbo].[view_jaratok] ([Vonalvezetes_id])
INCLUDE ([jarat_id],[jarat_szam],[jarat_indulas],[Leiras],[kozlekedesi_jel],[Kozl_jel_nev],[vonal_id],[irany])
WHERE [jarat_id] = 22
;


However, instead of yielding this as a formatting result

Code:

CREATE NONCLUSTERED INDEX [ix_view_jaratok____export_xml]
    ON [dbo].[view_jaratok] ([Vonalvezetes_id])
    INCLUDE ([jarat_id],[jarat_szam],[jarat_indulas],[Leiras],[kozlekedesi_jel],[Kozl_jel_nev],[vonal_id],[irany])
    WHERE [jarat_id] = 22;


, it mangles the code ending up in this:

Code:

CREATE NONCLUSTERED INDEX [ix_view_jaratok____export_xml]
    ON [dbo].[view_jaratok] ([Vonalvezetes_id])
    INCLUDE
(
   [jarat_id],
   [jarat_szam],
   [jarat_indulas],
   [Leiras],
   [kozlekedesi_jel],
   [Kozl_jel_nev],
   [vonal_id],
   [irany]
)
    WHERE [jarat_id] = 22;

Thu Jan 28, 2021 4:03 pm View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2100

Post Reply with quote
It seems to be fixed in 11.5.362.

EDIT: Hmm, I was a bit hasty, sometimes it's formatted right, sometimes not. I'm still trying to figure out what differences make it go wrong.

EDIT2: Okay, found something

This one formats properly:
Code:

CREATE NONCLUSTERED INDEX [fix_Forg_tetel____xml_export]
ON [dbo].[Forg_tetel] ([Datum])
INCLUDE
([jarat_id] ,[jarat_szam] ,[jarat_indulas] ,[Leiras] ,[kozlekedesi_jel] ,[Kozl_jel_nev] ,[vonal_id], [a123] );


but just adding one more characters to the last column name in the include part making it 5 characters long instead of 4
Code:

CREATE NONCLUSTERED INDEX [fix_Forg_tetel____xml_export]
ON [dbo].[Forg_tetel] ([Datum])
INCLUDE
([jarat_id] ,[jarat_szam] ,[jarat_indulas] ,[Leiras] ,[kozlekedesi_jel] ,[Kozl_jel_nev] ,[vonal_id], [a1234] );


will make the formatting result go bad. Check this short video here.

EDIT3: I checked the settings for Line Length for Code Wrapping and Line Length for DDL Code Wrapping and they were both set to 120 instead of 180 and 160 I set them. I loaded default options just to check and saw that those are indeed the factory default values for those two settings. I noticed that my custom DB Queries were also switched back to the factory defaults. I mean the queries are still there in DB Option / DB Queries but DB Options / SQL Assistance was set to use the old ones instead.

Is there something happening during the upgrade that reverts the changes I made to the settings? If so, is there a way to prevent that somehow?
Thu Jan 28, 2021 4:35 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7833

Post Reply with quote
Many thanks for reporting this issue. We will investigate and revert back to you as quickly as possible.
Fri Jan 29, 2021 12:05 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7833

Post Reply with quote
Quote:
but just adding one more characters to the last column name in the include part making it 5 characters long instead of 4


Let me respond to this one first. I was advised that this is a feature. You are hitting the limit set in "Line Length for DDL Code Wrapping" parameter, which by default is set to 120. If you want to disable it, you can set the parameter value to 0.


Quote:
Is there something happening during the upgrade that reverts the changes I made to the settings? If so, is there a way to prevent that somehow?

Here is a simplified description of the upgrade process. When installing new maintenance version or major version it attempts to merge the existing settings in the previous version settings file with the new version settings file by rolling forward some parts of the old file. There is a limit to that process. Certain parts and elements of the settings file are kind of "no touchy" they are obviously custom, like code snippets, formatting rules, etc... and they get transferred and added is to the new version as is. Other parts with internal function dependencies don't get transferred as not to cause potential conflicts and break the new version. Perhaps the settings you reference are in that category and not copied individually. I guess this is a subject to further improvements, the process needs to be smarter and more granular to support more customizations.
Fri Jan 29, 2021 11:14 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.