What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 122 Stack Exchange communities.

As has been discussed at least a few times, simple syntax errors are generally closed as Too Localized. The community's common practice seems to have coalesced around this more and more in the past 6 months, which is excellent.

Dealing with a specific class of these has left me with doubts, however. In , we see quite a few questions related to the use of unquoted MySQL reserved keywords as identifiers in queries. This results in error messages which always look exactly like:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'THE_RESERVED_KEYWORD

A few of these are common enough that it is a simple matter to search on the error message to locate an already existing duplicate to close against. The DESC keyword, for example is really common. ORDER is also common, anecdotally so are TO, KEY, INDEX and others...

So when one of these is encountered, the community can usually spot it immediately. My instinct is to search on the error message for a duplicate and closevote if I find one. If I don't find the duplicate I have taken a few different actions:

  • Just answer it
  • Answer it as community wiki and closevote as Too Localized since it's a syntax error
  • Leave a comment pointing to the MySQL docs and closevote as Too Localized (typically I do this now...)

The more I think about it though, closing these as Too Localized seems like the wrong approach. While it is entirely possible that the OP might have a syntax error in a CREATE PROCEDURE statement, experience tells me that a message like "the right syntax to use near 'procedure" is indicative of an inappropriate use of a keyword.

The error message itself then becomes a really valuable clue to finding the exact cause of and solution to the problem, unlike variable typos, missed semicolons, or unclosed braces.

Speaking only of the MySQL keywords, there are so many possibilities that it seems unwieldy to create a reference question like the PHP community has done with the error message reference, when the solution to the whole class of errors is the same in every case.


So...

What does the community think is best? If the error message is specific and exact should we:

  • Close as Too Localized (potentially inviting repeats of the same question later on (which may also get closed))
  • Answer and build the search reference for future askers (potentially inviting duplication)
  • Something else?
share|improve this question
4  
I think I picked the wrong day to ask on meta. Everyone's preoccupied with hats... –  meta.michael Dec 19 '12 at 15:05
2  
Do we get a hat if we answer your question? If not, I don't even want to look at it :p –  Laf Dec 19 '12 at 15:10
    
Yay! If we team up together, we can probably achieve a few hats among us! Let's go on an upvote/ask/answer rampage together! Now... did you have a question that is not related to hats? –  Laf Dec 19 '12 at 15:26
add comment

2 Answers

up vote 3 down vote accepted
+50

As you said, the syntax error can have multiple meanings.

It doesn't give you what's wrong in your syntax, just that it is wrong.

For that reason, it renders most of these questions "unworthy" (due to the lack of a better term) to be answered. That's because we are not compilers, nor debuggers.

Any of these questions can be solved with:

  1. A quick glance at the manual.
  2. An even quicker Google search.
  3. Or, at best, a decent IDE.

On the other hand, "Too Localized" seems a bit incorrect in this case. Too localized is to be used when a question's universe is so bizarre, so... local, that other users are likely to never reach it. That's usually the case with errors.

When an error becomes a very common thing, one question (the best formulated one) should be answered with a highly detailed, well-explained answer, and the others should be closed as duplicates of that. If there isn't a good one, ask it! And answer it yourself. It doesn't be a catch-all-super-reference question. Something along the lines of:

Why do I get a syntax error when there isn't one in my MySQL query?

Or even more specifically, if you'd like:

Why does using unquoted table/column names trigger a syntax error in MySQL?

share|improve this answer
add comment

I think we should keep such questions opened if the syntax error is common and can't be caught before the execution of the module/method/script/whatever. Your MySQL example just fits that description, whereas a Java type (like a missing ;) does not.

In your example, I would bet that many developpers have such syntax problems, and spend hours wondering why their apparently perfect script does not work like it should.

share|improve this answer
add comment

You must log in to answer this question.

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