Re: exposing COPY API

Itagaki Takahiro <itagaki.takahiro@gmail.com>

From: Itagaki Takahiro <itagaki.takahiro@gmail.com>
To: Andrew Dunstan <andrew@dunslane.net>, Shigeru HANADA <hanada@metrosystems.co.jp>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2011-02-08T08:49:09Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Allow the low level COPY routines to read arbitrary numbers of fields.

On Tue, Feb 8, 2011 at 09:38, Andrew Dunstan <andrew@dunslane.net> wrote:
> Here is a patch against the latest revision of file_fdw to exercise this
> API. It includes some regression tests, and I think apart from one or two
> small details plus a requirement for documentation, is complete.

The patch contains a few fixes for typo in the original patch.
Hanada-san, could you take them into the core file_fdw patch?

>   CREATE FOREIGN TABLE jagged_text (
>        t   text[]
>   ) SERVER file_server
>   OPTIONS (format 'csv', filename
>   '/home/andrew/pgl/pg_head/contrib/file_fdw/data/jagged.csv', header
>   'true', textarray 'true');

There might be another approach -- we could have jagged_file_fdw aside
from file_fdw, because we cannot support some features in textarray mode
like force_not_null option and multiple non-text[] columns.

I'll include NextCopyFromRawFields() in COPY API patch to complete
raw_fields support in CopyState. (Or, we should also revert changes
related to raw_fields.)  However, we'd better postpone jagged csv
support to 9.2. The design is still under discussion.

-- 
Itagaki Takahiro