 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
[SA 9.1.276 Pro] - Formatting anomaly in MySQL |
|
I've ran into a funny bug regarding code formatting in MySQL, where the formatted code gets formatted and duplicated without formatting at the same time. It only affects syntactically weird (and incorrect) code (or, at least, it had so far) but one of the most useful "side-effects" of code formatting is that it tends to make malformed code stick out as a sore thumb. The problem is the following:
Given is the code fragment below:
#1
 |
 |
SELECT 1 AS `a`;
|
With my current formatting rules this formats to the nice and clean
#2
 |
 |
-- /* Formatted to MySQL default at 2017-05-25 16:03:18*/
SELECT
1 AS `a`;
|
Now if I accidentally omit the second grave accent and try to format this:
#3
 |
 |
SELECT 1 AS `a;
|
it does not really matter, the result will be the same as #2.
If I really make a mess and omit the first one:
#4
 |
 |
SELECT 1 AS a`;
|
the code is no longer correct but that will be my slightest problem, because formatting that nasty little imp will turn into:
#5
 |
 |
-- /* Formatted to MySQL default at 2017-05-25 16:03:47*/
SELECT
1 AS
SELECT 1 AS a`;
|
which causes a rather nasty confusion in cases the not-so-mischievousbrat is hiding in a larger piece of otherwise valid code.
|
|
Thu May 25, 2017 10:09 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
We may have a "fix" for the code duplication in 9.2. The team looked into this issue and they think it's very easy to fix.
|
|
Tue May 30, 2017 9:08 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
That's good news, thank you very much. Not that it happens often but the first time I ran into it was pretty devastating.
UPDATE: Confirmed as fixed in [9.2.346 Pro].
|
|
Tue May 30, 2017 11:17 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
|
|
|