title: How to change the case of a table name in SQLite?
body: <p>I want to change a table name  in SQLite so that it is all lowercase. This command fails:</p>
  <pre><code>ALTER TABLE My_Table RENAME TO my_table;
  
  Error: there is already another table or index with this name: my_table
  </code></pre>
  <p>I know SQLite commands are case-insensitive, but I need this for reasons external to SQLite. I should also say that I want to automate the process.</p>
  <p>One feasible solution is to do it in two steps:</p>
  <ol>
  <li>rename the table using a temporary name, and</li>
  <li>rename the table from the temporary name to the lowercase name:</li>
  </ol>
  <pre><code>ALTER TABLE My_Table RENAME TO My_Table_tmp;
  ALTER TABLE My_Table_tmp RENAME TO my_table;
  </code></pre>
  <p>However a failsafe scheme to chose a temporary name is not obvious to me as a table with the temporary name <code>My_Table_tmp</code> (for example) could already exist, maybe from some failed attempt prior. I realize these could be rare cases, but I am still interested in knowing if anyone has a single-step solution.</p>