COPY FROM WHEN condition

Surafel Temsgen <surafel3000@gmail.com>

From: Surafel Temesgen <surafel3000@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2018-10-11T08:54:55Z
Lists: pgsql-hackers

Attachments

Hello,

Currently we can not moves data from a file to a table based on some
condition on a certain column but I think there are many use case for it
that worth supporting. Attache is a patch for escaping a row that does not
satisfy WHEN condition from inserting into a table and its work on the top
of commit b68ff3ea672c06

and the syntax is

COPY table_name [ ( column_name [, ...] ) ]

FROM { 'filename' | PROGRAM 'command' | STDIN }

[ [ WITH ] ( option [, ...] ) ]

[ WHEN condition ]

comment ?

Regards

Surafel

Commits

  1. Remove unused struct member, enforce multi_insert callback presence.

  2. Separate per-batch and per-tuple memory contexts in COPY

  3. Fix handling of volatile expressions in COPY FROM ... WHERE

  4. Allow COPY FROM to filter data using WHERE conditions

  5. Remove obsolete netbsd dynloader code