Skip to content

Instantly share code, notes, and snippets.

@ojacobson
Created October 23, 2012 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojacobson/3939871 to your computer and use it in GitHub Desktop.
Save ojacobson/3939871 to your computer and use it in GitHub Desktop.
CREATE TEMPORARY TABLE foo_staging LIKE FOO;
-- replace with bulk insert if you like
\copy into foo_staging [...]
INSERT INTO foo
SELECT
foo_staging.*
FROM
foo_staging
LEFT JOIN foo USING (key, columns, here)
WHERE
foo.key IS NULL
AND foo.columns IS NULL
AND foo.here IS NULL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment