Thread: appending from table to table

appending from table to table

From
"Johnson, Shaunn"
Date:
Howdy :
 
I'm running Postgres 7.1.3 on RedHat Linux 7.2 kernel version 2.4.7 rel 10.  
(I'm on a roll today with the questions, right?) 
 
Say I have a table.  On a monthly basis, someone exports from MS Access a new table
but the contents needs to be appended into the pre-existing table (call it orig_table).
 
I'm trying to develop an automated means to do this, but the best I could come up with is:
 
* run a cron job to dump the new table into a flat file
*modify the flat file - insert a line that says '\copy orig_table from <name_of_file>'
* run a job that wakes up and `psql -U <user> -d <database> -f ./<name_of_file> `
*verify the orig_table (maybe get a count of new records; before / after; something).
 
Is there an easier way to do this?
 
Thanks!
 
-X