Variables ambiguities in names and values

April 28, 2009

Writing up some scripts, I see more and more ambiguities with regard to global variables.

For one thing, the names ambiguity between the hyphen ('-') and the underscore ('_'). So wait_timeout and wait-timeout are the same variable.

But just check out the many levels of inconsistency:

  • Command line arguments (e.g. run mysqld with option variables) use the hyphen convention
  • mysql --verbose --help shows the hyphen convention
  • SHOW GLOBAL VARIABLES uses the underscore convention
  • The MySQL supplied sample configuration files use both conventions interchangeably

Enough? Not quite: there are ambiguities in values, as well. For example, you may set query_cache_type to 1 or ON. These are equivalent. That's very friendly. However:

  • mysql --verbose --help will show "query_cache_type 1"
  • SHOW GLOBAL VARIABLES will show "query_cache_type ON"

We also have:

  • 1 <==> YES
  • OFF <==> FALSE
  • ON <==> TRUE

Time to decide. Ambiguities are evil. They make for a difficult parsing/analysis/comparison/validation work. Will anyone pick the glove?

PS - Drizzle falk - isn't this the kind of stuff you're happy to drop?

tags:
posted in MySQL by shlomi

« | »

Follow comments via the RSS Feed | Leave a comment | Trackback URL

6 Comments to "Variables ambiguities in names and values"

  1. ahmad wrote:

    you are right. there should be a standard for this.

  2. Pavel wrote:

    Thanks for the post. Before I got used to the ambiguity, I kept looking into the docs. Having a single notation would be something to look forward to in both drizzle and mysql.

  3. Devananda wrote:

    Yes, this has annoyed me too, particularly early on. There's a discussion right now about refactoring the configuration management for Drizzle into a plugin, hopefully fixing this can be included in that project :)

  4. Jay Pipes wrote:

    Hi! Yep, the Drizzle community, as Devananda mentioned, is currently discussing this. The thread in questions starts here:

    https://lists.launchpad.net/drizzle-discuss/msg03804.html

    Cheers!

    Jay

  5. INFORMATION_SCHEMA.GLOBAL_STATUS: watch out | code.openark.org wrote:

    [...] There are a few ON/OFF values (I’ve expressed my opinion and concerns on these here and here; why not just use 0/1?). SSL_CIPHER seems like the only variable which can get long enough [...]

  6. Rick James wrote:

    The programming public is Boolean-challenged. I get so irritated every time I see (in any of several languages)
    if () x = TRUE else x = FALSE;

    The equivalence of 0/false/off and 1/true/on will be hard to 'teach', regardless of which way you go.

    I do agree that consistency would be nice. Fortunately, MySQL is usually forgiving.

    Another frustration: The flags that are done by there presence/absence, perhaps including
    log-slave-updates
    skip-external-locking

Leave Your Comment

 
Powered by Wordpress and MySQL. Theme by openark.org