Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 117C047589C for ; Tue, 13 Aug 2002 18:41:01 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 83B944754A0 for ; Tue, 13 Aug 2002 18:41:00 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g7DMf1Vk002009; Tue, 13 Aug 2002 18:41:01 -0400 (EDT) To: pacquet@newsguy.com Cc: pgsql-interfaces@postgresql.org Subject: Re: PQputline in BINARY mode? In-reply-to: <200208132215.PAA79633@newsguy.com> References: <200208132215.PAA79633@newsguy.com> Comments: In-reply-to pacquet@newsguy.com message dated "Tue, 13 Aug 2002 15:15:11 -0700" Date: Tue, 13 Aug 2002 18:41:01 -0400 Message-ID: <2008.1029278461@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/40 X-Sequence-Number: 3002 pacquet@newsguy.com writes: > However, this is an embedded system, so some modest amount of > backend-hacking is quite acceptable if the payoff is large enough. Do > you have any pointers on implementing a variant of COPY BINARY <> FROM > file that works out of memory instead of a file? I think what you want is to hack the fe/be protocol so you can pass binary data in the COPY from stdin/to stdout datastream. The problem is that the message protocol for COPY is ASCII strings (ugh). Change it to be counted strings and away you go. (There are more changes that I want to see in this area than that, but that should get you the functionality you want...) backend/commands/copy.c and PQgetline/PQputline on the frontend side are the things to look at. Also read the SGML docs' chapter about the fe/be protocol. regards, tom lane