title: How to rename a table inside a schema?
body: <p>I'm using PostgreSQL 9.x, I want to rename a table.  This SQL code:</p>
  
  <pre><code>CREATE TABLE new (id int);
  ALTER TABLE new RENAME TO old;
  DROP TABLE old;
  </code></pre>
  
  <p>renames the table correctly.  But this SQL code:</p>
  
  <pre><code>CREATE SCHEMA domain;
  CREATE TABLE domain.old (id int);
  ALTER TABLE domain.old RENAME TO domain.new;
  </code></pre>
  
  <p>fails, with error:</p>
  
  <blockquote>
    <p>ERROR: syntax error at or near "."  </p>
  </blockquote>
  
  <p>The "." underlined is the one between 'domain' and 'new'</p>