INSERT INTO patents_merged ( SELECT patents.patentnumber, patents.grantdate, patents.prioritydate, patents.prioritycountry, patents.prioritypatentnumber, patents.cpcsubgroup, patents.pctpatentnumber, patents.numberofclaims,
patents.applicationnumber, NULL, patents.filingdate, NULL, NULL, NULL, NULL FROM patents );
Equivalent COPY statements:
patents.applicationnumber, NULL, patents.filingdate, NULL, NULL, NULL, NULL FROM patents) TO '/tmp/merged_patents_export.txt' DELIMITER AS E'\t' HEADER NULL AS CSV;
--COPY 1646225
Then copy CSV file into table:
\COPY patents_merged FROM '/tmp/merged_patents_export.txt' DELIMITER AS E'\t' HEADER NULL AS CSV;
-- RESULT : COPY 1646225
where "patents" is the name of the table containing the data from the RDP update and "patents_merged" is the name of the table we want to insert the new data into.