title: In Postgres, how do you restrict possible values for a particular column?
body: <p>I want to create a column <code>element_type</code> in a table (called <code>discussion</code>) that allows the text values "lesson" or "quiz" but will generate an error if any other value is inserted into that column.</p>
  
  <p>I understand that I could create a separate table called <code>element_types</code> with columns <code>element_id</code> (primary key, int) and <code>element_type</code> (unique, text) and create a foreign key <code>foreign_element_id</code> in the table <code>discussion</code> referencing <code>element_types</code>'s column <code>element_id</code>.  Or alternatively, I could forget <code>element_id</code> altogether and just set <code>element_type</code> as the primary key.  But I want to avoid creating a new table.</p>
  
  <p>Is there a more straightforward way to restrict possible values in a column without creating a new table?</p>