List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:January 3 2000 9:36pm
Subject:Re: Escaping Fieldnames?
View as plain text  
>>>>> "Tim" == Tim Bunce <Tim.Bunce@stripped> writes:

Tim> On Mon, Jan 03, 2000 at 04:35:37PM +0200, sinisa wrote:
>> 
>> 'Use' is  a reserved word in ANSI SQL92. 
>> 
>> You must change a column name in order to create it .

Tim> But ANSI SQL92 also allows identifiers to be enclosed in double quotes
Tim> to avoid them being interpreted as reserved words.

Tim> It's a pity MySQL doesn't support that - it ought to be a fairly simple
Tim> addition to the parser.

Hi!

In MySQL 3.23.7 and above, you can use the ` for this:

CREATE TABLE test (`Use` int);

If you start mysqld with --ansi-mode, you can even use ", but I think
that in this case you will probably get problems with some of the
Contributed MySQL clients that may use " as a string delimiter.

Regards,
Monty

PS: It was a simple addition to the parser, but had a lot of difficult
    implications as you can now also quote databases and table names;
    It took me 8 hours to get everything right...  You can find a lot
    more information about this in the MySQL manual :)
Thread
Escaping Fieldnames?Nathan Poole3 Jan
  • Re: Escaping Fieldnames?sinisa3 Jan
    • Re: Escaping Fieldnames?Tim Bunce3 Jan
      • Re: Escaping Fieldnames?Benjamin Pflugmann3 Jan
        • Re: Escaping Fieldnames?Tim Bunce3 Jan
      • Re: Escaping Fieldnames?Michael Widenius4 Jan
  • Re: Escaping Fieldnames?Matthew Vanecek3 Jan
    • Re: Escaping Fieldnames?Benjamin Pflugmann3 Jan
RE: Escaping Fieldnames?Nathan Poole3 Jan
RE: Escaping Fieldnames?Nathan Poole4 Jan