5

I came across a proposed edit where the code (a SELECT statement) is considered by editor to be incorrect so editor proposes changes in the code.

select * from db
cross join (select count(*) from db2) t1
cross join (select count(*) from db3) t2

would become

select * from db
cross join (select count(*) as total2 from db2) t1
cross join (select count(*) as totla3 from db3) t2

Intuitively, I would tend to reject said edit because an incorrect answer should be indicated as such, IMO. I.e., the editor should comment regarding incorrect syntax and propose a correct answer with reference to author of original answer.

Is this the correct/ethical procedure to adopt?

NOTE: many posts address similar issues, but they to all seem to pertain to style; I could not find any question in MSO which addresses changes to correct an incorrect answer or malfunctioning snippet proposed by another author.

3
  • 1
    You shoud see this and this Commented Nov 16, 2015 at 18:00
  • @NathanOliver tks. just reviewed them, but one is about typos (not the case im discussing) and the other did not have any answers (just comments).
    – tony gil
    Commented Nov 16, 2015 at 18:18
  • Pretty absurd to reject a correct edit like that. I guess it is okay if you don't know beans about sql, but, please, don't review sql questions then and hit the Skip button. Commented Nov 16, 2015 at 18:32

2 Answers 2

3

That should be rejected. There's some leeway around missing semicolons, unclosed parentheses, and the like in answers (but not in questions). It's not appropriate, however, to edit things like how somebody names variables or columns in a query.

For example, if posted an answer telling someone to run this code in c:

int i = 0;
i++
i++;

It's generally acceptable to edit to add the ; in the second line, after first bringing it to the attention of the post's author in a comment and waiting some reasonable period of time (think hours or days, not seconds). (Note, though, that even edits like this are inappropriate in a question. Often, the problem in the question is a typo, so editing out the typo makes the question unintelligible.)

On the other hand, if I posted this code:

int i = 0;
i++;
i++;

Changing it in any of these ways would be inappropriate without express permission from the author:

  • renaming i to countOfActiveUsers or something like that,
  • changing the two i++; statements to i += 2;,
  • creating a macro or function to take i and return i+2,
  • adding comments,
  • and so on.

Changes like those are substantive. They're either attempts to reply, comments, or simply attempts to commandeer the post.

4
  • 1
    Ed! the man who made the best pitch in mod nominations and is getting my vote. If there was even an inkling of a doubt in my mind, now it's gone. TKS a zillion for the answer.
    – tony gil
    Commented Nov 16, 2015 at 18:27
  • 1
    Hey, thanks, @tonygil! That's very kind of you.
    – elixenide
    Commented Nov 16, 2015 at 18:27
  • 1
    An obvious typo should be corrected directly, if you can. Waiting and commenting is just a waste of time. If it gets to the substance of the post though... (as an aside, if the typo is the reason for a question, we don't want it. Please close- and downvote.) Commented Nov 16, 2015 at 19:16
  • 1
    @Deduplicator My example regarding the typo isn't the best. My point is that there are many examples of something that looks like a typo but is critically important. For example, if the code contains a regex or c pointer references and dereferences, things can get confusing. As for typo-driven questions: nearly all such questions should be closed immediately, but some typos are subtle, especially if the syntax at issue isn't documented clearly anywhere (I've asked one of those, myself). In any event, closing it as typo-driven is only appropriate if the problem has been resolved somehow.
    – elixenide
    Commented Nov 16, 2015 at 19:23
1

Yes, it is appropriate to edit code in a post, if:

  • It does not change the intended meaning of the post.
  • It doesn't change the post from one perfectly usable style to another one.
  • Or the OP indicated that change in comments, but forgot to / did not know how to edit his post.

If a typo is the reason for a question, it's with near certainty crap which should be downvoted and closed fast (add a comment, and there's a dedicated close-reason).

2
  • i did not mean MINOR changes, in which case i agree it is acceptable. i meant code correction on grossly incorrect pseudo code.
    – tony gil
    Commented Nov 20, 2015 at 11:59
  • 1
    Well, swapping grossly incorrect pseudo-code for something correct is obviously far beyond anything condoned. Commented Nov 20, 2015 at 12:11

Not the answer you're looking for? Browse other questions tagged .