Changes

Jump to navigation Jump to search
CREATE OR REPLACE FUNCTION cleanpatno (text) RETURNS bigint AS $$ if ($_[0]) { my $var=$_[0]; if ($var=~/^\d*$/) {return $var;} return undef; } return undef; $$ LANGUAGE plperl;
INSERT statement
INSERT INTO citation ( SELECT new_citations.citingpatentnumber, new_citations.citedpatent number FROM patents );
Equivalent COPY statement:
\COPY citations (SELECT new_citations.citingpatentnumber, new_citations.citedpatent number FROM patents) TO '/tmp/citations_merge_export.txt' DELIMITER AS E'\t' HEADER NULL AS CSV;
--COPY 1646225
Then copy CSV file into table:
\COPY citations_merged FROM '/tmp/citations_merge_export.txt' DELIMITER AS E'\t' HEADER NULL AS CSV; --1607724

Navigation menu