title: psql: copying to table issue
body: <p>Say I have users.data containing...</p>
  
  <pre><code>Jeff    31  2
  Niel    42  15
  Chucky  42  15
  Paul    48  15
  Bert    18  0
  Geoff   28  16
  Kieth   64  31
  Clyde   20  0
  Greg    44  3
  Bonnie  19  0
  Meyer   34  6
  Alice   41  3
  </code></pre>
  
  <p>And in psql, I create a users table like this...</p>
  
  <pre><code>ID |  name | age | number
  ---+-------+-----+----------
  1    Jeff     31     2
  2    Niel     42    15
  3    Chucky   42    15
  4    Paul     48    15
  5    Bert     18     0
  6    Geoff    28    16
  7    Kieth    64    31
  8    Clyde    20     0
  9    Greg     44     3
  10   Bonnie   19     0
  11   Meyer    34     6
  12   Alice    41     3
  </code></pre>
  
  <p>And then I have events.data containing...</p>
  
  <pre><code>Jeff    Party   Newtown 2012-02-16
  Jeff    Work    Oldtown 2005-03-30
  Chucky  Work    Oldtown 2008-11-09
  Niel    Work    Newtown 2005-02-28
  Paul    Party   Newtown 2010-02-14
  Bert    Work    Oldtown 2005-03-30
  Geoff   Work    Newtown 2013-04-20
  Kieth   Sleep   Oldtown 2009-08-03
  Clyde   Party   Newtown 2012-02-16
  Greg    Work    Newtown 2013-04-20
  Bonnie  Sleep   Newtown 2009-08-30
  Meyer   Sleep   Newtown 2008-10-30
  Alice   Work    Newtown 2012-03-30
  </code></pre>
  
  <p>How do I create the table, events,  like this? </p>
  
  <pre><code>ID | user_ID | event |   city        date
  ---+---------+-------+----------+--------------
  1      1       Party    Newtown     2012-02-16
  2      1       Work     Oldtown     2005-03-30
  3      2       Work     Oldtown     2008-11-09
  4      3       Work     Newtown     2005-02-28
  5      4       Party    Newtown     2010-02-14
  6      5       Work     Oldtown     2005-03-30
  7      6       Work     Newtown     2013-04-20
  8      7       Sleep    Oldtown     2009-08-03
  9      8       Party    Newtown     2012-02-16
  10     9       Work     Newtown     2013-04-20
  11    10       Sleep    Newtown     2009-08-30
  12    11       Sleep    Newtown     2008-10-30
  13    12       Work     Newtown     2012-03-30
  </code></pre>
  
  <p>Basically, when I populate the tables I've created and when I am going to copy the data to the files, I need to find the id of the of the user matching the user name attribute of the event record. So when you look at the events table, instead of displaying the name, it is instead showing the id of the user of that same name.</p>
  
  <p>How can I go about doing this? Am I able to do this when I use...</p>
  
  <pre><code>COPY events (user_ID, event, city, date) FROM :dir || 'events.data' WITH (/* ??? */);
  </code></pre>