title: Is there a way to enforce a specific string structure for a Postgres column?
body: <p>I have a field in a database that is a string of the form XXXYYXXXX where the Xs are numbers and the Ys are letters -- is there a way to define the table such that trying to insert a new row where this field fails to match causes an error? </p>
  
  <p>I'd know how to do this if I was working with the DB through an ORM, but haven't had to do validation like this in pure SQL.</p>