Re: SQL/MED - file_fdw
Itagaki Takahiro <itagaki.takahiro@gmail.com>
From: Itagaki Takahiro <itagaki.takahiro@gmail.com>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Shigeru HANADA <hanada@metrosystems.co.jp>, pgsql-hackers@postgresql.org
Date: 2010-12-14T03:01:36Z
Lists: pgsql-hackers
Attachments
- copy_export-20101214.diff (application/octet-stream) patch
On Tue, Dec 14, 2010 at 01:25, Andrew Dunstan <andrew@dunslane.net> wrote: > On 12/13/2010 11:12 AM, Tom Lane wrote: >> I think that exposing the guts of COPY to the open air is a bad idea. I don't want to export the details, too. > In that case I guess I'll need to do what Shigeru-san has done, and copy > large parts of copy.c. I found file_fdw would require the executor state in CopyState and the error callback function. I revised the patch to export them. Now 5 functions are exported from copy.c: - BeginCopyFrom(rel, filename, attnamelist, options) : CopyState - EndCopyFrom(cstate) : void - NextCopyFrom(cstate, OUT values, OUT nulls, OUT tupleOid) : bool - GetCopyExecutorState(cstate) : EState * - CopyFromErrorCallback(arg) Are they enough, Shigeru-san? Note that the internal CopyFrom() is now implemented only with them, so I think file_fdw is also possible. BTW, we might have another choice instead of GetCopyExecutorState() because the EState will be used only for ResetPerTupleExprContext() in file_fdw. If NextCopyFrom() returns a HeapTuple instead of values and nulls arrays, we could hide EState in NextCopyFrom(). -- Itagaki Takahiro