title: Problems with escaping table and field names in Derby and Hsqldb
body: <p>I'm having a problem with my <a href="http://ormlite.com/" rel="nofollow noreferrer">ORMLite package</a>.  When I generate the schema for a table, I thought it would be a good practice to escape all entity names.  This would protect some Java class or field name from being a SQL reserved word:</p>
  
  <pre><code>CREATE TABLE "footable" ("stuff" VARCHAR(255))
  </code></pre>
  
  <p>I'm now adding "raw" query support so that ORMLite can help users perform their own queries.  However, I find that with Derby and Hsqldb, the entity names cannot be used <em>without</em> escaping.  For example, the following query:</p>
  
  <pre><code>SELECT * FROM footable
  </code></pre>
  
  <p>generates the following errors:</p>
  
  <pre><code>Derby: ERROR 42X05: Table/View 'FOOTABLE' does not exist.
  Hsqldb: Table not found in statement [select * from footable]
  </code></pre>
  
  <p>It works fine if the select table is also escaped as <code>"footable"</code>.  The other databases supported by ORMLite work fine with or without the escaping: MySQL, Postgres, Microsoft SQL Server, H2, and Sqlite.</p>
  
  <p>Are there better ways to escape reserved words in Derby and Hsqldb?  Other ideas about how to do this in a portable manner?</p>
  
  <p>Thanks.</p>