Re: Bug Report: Restrictions on index naming

2003-01-14 Thread Jeremy Zawodny
On Wed, Jan 15, 2003 at 11:44:24AM +1100, Daniel Kasak wrote:
 Hi all,
 
 I recently had to restore from a backup and discovered that mysql didn't 
 want to re-create a table which had the minus symbol (-) in it, eg

Yeah, you need to quote such names now.

Upgrade your version of mysqldump and the problem will go away, I
believe.
-- 
Jeremy D. Zawodny |  Perl, Web, MySQL, Linux Magazine, Yahoo!
[EMAIL PROTECTED]  |  http://jeremy.zawodny.com/

MySQL 3.23.51: up 30 days, processed 1,013,700,735 queries (379/sec. avg)

-
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 [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Bug Report: Restrictions on index naming

2003-01-14 Thread Jennifer Goodie
MySQLCC probably uses the backtick (`) to escape stuff so it issued
UNIQUE KEY `IDX_Postcode-Location` (Postcode,Location)
and not
UNIQUE KEY IDX_Postcode-Location (Postcode,Location)

It has been mentioned on the list a few times in the last couple months that
if you escape strings containing hyphens with a backtick they work.  That
doesn't mean it is a good idea to use them.

You can try running your dump with the quote-names flag, maybe.  I haven't
tried it to see what the output is.  Run mysqldump's help to see what all
the flags are and what they mean.

-Original Message-

Hi all,

I recently had to restore from a backup and discovered that mysql didn't
want to re-create a table which had the minus symbol (-) in it, eg

DROP TABLE IF EXISTS Postcodes;
CREATE TABLE Postcodes (
   DanPK mediumint(8) unsigned NOT NULL auto_increment,
   MyStamp timestamp(14) NOT NULL,
   Postcode smallint(2) NOT NULL default '0',
   Location varchar(100) default NULL,
   State char(3) default NULL,
   RegionID mediumint(8) unsigned NOT NULL default '0',
   PRIMARY KEY  (DanPK),
   UNIQUE KEY IDX_Postcode-Location (Postcode,Location)
) TYPE=MyISAM;

I had added the index with MySQLCC (I think) and the database had been
working fine as far as I could tell (minus the crash this morning). The
table def is from mysqldump --opt, which I use each night, in
combination with the --log-update option to assist in disaster recovery.

When I tried to restore from the backup (mysqldump output) it gave me a
syntax error around the -Location bit.

But it _did_ let me create the index like this before. Thinking about it
more, I probably shouldn't have used a minus. I can see why that would
be reserved. Any chance of enforcing that in alter table commands (which
I would have used to get the index there), or is it considered too
expensive to do these kinds of checks?





-
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 [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php