What is wrong with this schema definition and db query? Hello and thank you for your time to help me in this weird case. 
I have a schema API function that returns few database table information, and everything seem to work fine... except the most simple table. 

$schema['quotes_key'] = array(
  'description' =&gt; 'Auth keys for quotes',
  'fields' =&gt; array(
      'qid' =&gt; array(
        'description' =&gt; 'The {quotes} this key belongs to.', 
        'type' =&gt; 'int', 
        'not null' =&gt; TRUE, 
      ), 
      'key' =&gt; array(
        'description' =&gt; 'Key of the qid to be accessed anonymously.', 
        'type' =&gt; 'varchar', 
        'length' =&gt; 255, 
        'not null' =&gt; TRUE, 
      ),
    ),
    'primary key' =&gt; array('qid'),
    'indexes' =&gt; array(
      'qid'        =&gt; array('qid'),
    ),
  );


Then, I use drupal_write_record to write a new object to the database. 

$key = new stdClass();
$key-&gt;qid = 789;
$key-&gt;key = md5(uniqid());
drupal_write_record('quotes_key', $key);


Whenever I run this code, I'm getting a mysql error:

user warning: 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 'key) VALUES (789, '02ab38a849e02744f532cdf3137df146')' at line 1 query: INSERT INTO quotes_key (qid, key) VALUES (1, '02ab38a849e02744f532cdf3137df146') in .../includes/common.inc on line 3576.


Can anyone kindly help me to figure out the problem ? I tried db_query to do the same database INSERT but getting same error. So I guess the problem is with my schema. 
the qid is stored in a {quote} table.

I tried reinstalling schema by drupal_uninstall_schema() and drupal_install_schema()

Thank you.
I believe key is a reserved word. I'd stray away from using the key instead of trying to get MySQL to accept it. But here's some examples on how to get around it (which might not be possible via Drupal's db api).

https://stackoverflow.com/questions/2889871/how-do-i-escape-reserved-words-used-as-column-names-mysql-create-table