How can I create a constraint to use a regular expression in postgres?
CREATE TABLE emails ( email varchar CONSTRAINT proper_email CHECK (email ~* '^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+[.][A-Za-z]+$') );
(regex may be incomplete, you can search for regexp for email matching all over the web and pick the one you like best).