title: PG::SyntaxError: ERROR: syntax error at or near
body: <p>I am trying to connect directly to a postgres database and run a query. It tells me the table, which is a view does not exist, but  I see it listed.  What am I missing?</p>
  <h1>Code</h1>
  <pre><code>require 'pg'
  conn = PG::Connection.open(:dbname =&gt; 'mydatabase')
  
  conn.exec(&quot;Select * From Distinct_filing_xml_view&quot;)
  </code></pre>
  <h1>ERROR</h1>
  <pre><code>PG::UndefinedTable: ERROR:  relation &quot;distinct_filing_view&quot; does not exist
  LINE 1: Select * From Distinct_filing_xml_view
                        ^
  
      from (irb):5:in `exec'
      from (irb):5
      from /Users/aa/.rbenv/versions/2.3.3/bin/irb:11:in `&lt;main&gt;'
  </code></pre>
  <h1>Tables</h1>
  <pre><code>res= conn.exec(&quot;select table_name from INFORMATION_SCHEMA.views&quot;)
  res.each {|i| puts i }
  {&quot;table_name&quot;=&gt;&quot;Max_filing_xml_view&quot;}
  {&quot;table_name&quot;=&gt;&quot;Distinct_filing_xml_view&quot;}
  {&quot;table_name&quot;=&gt;&quot;Filing_xml_view&quot;}
  {&quot;table_name&quot;=&gt;&quot;select_in_max_subdate_view&quot;}
  {&quot;table_name&quot;=&gt;&quot;max_sub_date&quot;}
  </code></pre>
  <h1>Update: Found Solution</h1>
  <pre><code>res = conn.exec('Select * From &quot;Distinct_filing_xml_view&quot;')
  </code></pre>
  <p>Does anyone know why the quotes are needed?</p>