List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:June 16 2002 9:37pm
Subject:Re: Syntactic Glitch or User Oversight?
View as plain text  
At 16:37 +0100 6/16/02, mysql-readers@stripped wrote:
>Hi,
>
>I tried something like the following (MySQL 3.23.36 on RH7.1) and got
>the error indicated below.
>
>     create table product ( /* The main table -- see below... */
>         id int not null auto_increment,        /* some text here */
>         parid int not null,                    /* and here */
>         descrip varchar(20) not null,          /* more */
>         prodcode varchar(20) not null,         /* more */
>         costcode int not null,                 /* more */
>         locales set("GB","EU","US") not null,  /* more */
>         primary key (id));                     /* last comment here */
>
>     ERROR 1072: Key column 'id' doesn't exist in table
>
>
>The problem is _avoided_ by removing the double-hyphen from the first
>comment in the above example. So, it's okay if I do the following
>instead (where I've *only* removed a single hyphen in the first
>comment): -
>
>     create table product ( /* The main table - see below... */
>         id int not null auto_increment,        /* some text here */
>         parid int not null,                    /* and here */
>         descrip varchar(20) not null,          /* more */
>         prodcode varchar(20) not null,         /* more */
>         costcode int not null,                 /* more */
>         locales set("GB","EU","US") not null,  /* more */
>         primary key (id));                     /* last comment here */
>
>So, either I've missed something about the meaning of "--" inside a
>comment, or there's a syntactic problem, maybe in the MySQL client,
>coz that's where I was doing my (interactive) testing.

That's the source of the problem.  mysql's parser is more primitive
than the server's parser, and it's clearly getting confused about
the statement.  Similar sorts of problems occur when a /* ... */
comment includes a ' or " character (the parser sometimes thinks that
indicates the beginning of a non-commented string).

>
>This isn't a problem for me (now I've figured it out), but thought
>I'd mention it anyway -- if you want more comment from me then please
>email me directly as I'm not reading the List at the moment.
>
>
>--
>Cheers,
>James.
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread112116@stripped>
>To unsubscribe, e-mail <mysql-unsubscribe-paul=snake.net@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Thread
Syntactic Glitch or User Oversight?mysql-readers16 Jun
  • Re: Syntactic Glitch or User Oversight?Galen Wright-Watson16 Jun
    • Re[2]: Syntactic Glitch or User Oversight?mysql-readers16 Jun
    • Re: Syntactic Glitch or User Oversight?Georg Richter16 Jun
  • Re: Syntactic Glitch or User Oversight?Paul DuBois16 Jun