title: PostgreSQL: default constraint names
body: <p>When creating a table in PostgreSQL, default constraint names will assigned if not provided:</p>
  
  <pre><code>CREATE TABLE example (
      a integer,
      b integer,
      UNIQUE (a, b)
  );
  </code></pre>
  
  <p>But using <code>ALTER TABLE</code> to add a constraint it seems a name is mandatory:</p>
  
  <pre><code>ALTER TABLE example ADD CONSTRAINT my_explicit_constraint_name UNIQUE (a, b);
  </code></pre>
  
  <p>This has caused some naming inconsistencies on projects I've worked on, and prompts the following questions:</p>
  
  <ol>
  <li><p>Is there a simple way to add a constraint to an extant table with the name it would have received if added during table creation?</p></li>
  <li><p>If not, should default names be avoided altogether to prevent inconsistencies?</p></li>
  </ol>