Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 072229FBB0D for ; Wed, 13 Jun 2007 05:16:46 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 78048-05 for ; Wed, 13 Jun 2007 05:16:33 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail63.csoft.net (leary.csoft.net [205.205.214.5]) by postgresql.org (Postfix) with SMTP id 528E29FBB77 for ; Wed, 13 Jun 2007 05:16:37 -0300 (ADT) Received: (qmail 23505 invoked by uid 1112); 13 Jun 2007 08:16:35 -0000 Date: Wed, 13 Jun 2007 04:16:35 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Kalle Hallivuori cc: pgsql-jdbc@postgresql.org Subject: Re: FYI: porting Copy API to 8.x In-Reply-To: Message-ID: References: <66D125B2-3C81-467E-BC02-D784ACDD5499@fastcrypt.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/47 X-Sequence-Number: 17109 On Mon, 11 Jun 2007, Kalle Hallivuori wrote: > Attached is a patch against postgresql-jdbc-8.2-505.src containing > Copy support inside v3/QueryExecutorImpl usable through a separate API > together with minimal unit tests and documentation. > This patch doesn't apply cleanly because there's a mix of unix and windows EOL characters and it seems to have some other application problems. The API is not thread safe. If two threads are using the same connection the synchronization in QueryExecutorImpl prevents them from stepping on each others toes and writing garbage to the backend. So the call to QueryExecutor must be an atomic operation and implies that the QueryExecutorImpl will be the controller and demand/push data from some kind of copy client instead of the other way around. Also I'm not especially fond of the row based API that you've come up with. It seems like you should either go to an element or stream based API. Who has a premade row? They've either got single fields or a bulk stream. Consider someone with a CSV file on their client machine that they want to copy to the server, they'd have to parse it to break it into rows which can be tricky with embedded newlines. They'd like an easy way to just dump it to the server and let it deal with it. Kris Jurka