title: Quoting column names with NHibernate and PostgreSQL
body: <p>I have started to use NHibernate 3.0 and PostgreSQL for a small project, so far the ride has been a little rough due to the NHibernate site being down and I'm sure this answer is on their website somewhere.</p>
  
  <p>I have a database that has these two columns(of course there is more in the real table):</p>
  
  <pre><code>int ID
  String Feature
  </code></pre>
  
  <p>now I'm using a FluentNHibernate to do the mapping so something like this:</p>
  
  <pre><code>public class MyEntityMap: ClassMap&lt;MyEntity&gt;
  {
      public MyEntityMap()
      {
          Id(x =&gt; x.ID);
          Map(x =&gt; x.Feature);
      }
  }
  </code></pre>
  
  <p>and a LINQ query to get out the data</p>
  
  <pre><code>var strucs = from str in session.Query&lt;MyEntity&gt;()
               where str.ID &lt; 5
               select str;
  </code></pre>
  
  <p>The query will generate the proper SQL statement, well sort of. The problem is, because I have uppercase letters in my column names you have to wrap them in quotes but the generated SQL code looks something like this:</p>
  
  <pre><code>SELECT this_.ID as ID0_0_, this_.feature as feature0_0_, 
         FROM "MyEntity" this_ WHERE this_.ID &lt; 5
  </code></pre>
  
  <p>Where the columns don't have quotes around them.  If I run this I get a "column this_.id" is not found etc.</p>
  
  <p>Does anyone know how I can get NHibernate to wrap the column names in quotes?</p>
  
  <p><strong>EDIT:</strong> I can't lowercase the column names as there are some columns that a third party program needs to be all in uppercase.</p>
  
  <p>I tried adding .ExposeConfiguration(cfg => cfg.SetProperty("hbm2ddl.keywords","auto-quote") but it doesn't seem to do anything.</p>