Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7AqD-00030h-0u for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jun 2015 23:09:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z7AqC-0003am-GG for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jun 2015 23:09:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z7ApO-0002sh-Vu for pgsql-bugs@postgresql.org; Mon, 22 Jun 2015 23:08:35 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z7ApL-0005tR-RW for pgsql-bugs@postgresql.org; Mon, 22 Jun 2015 23:08:34 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t5MN8SPR009890; Mon, 22 Jun 2015 19:08:28 -0400 From: Tom Lane To: socketpair@gmail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13462: Impossible to use COPY FORMAT BINARY in chunks through libpq In-reply-to: <20150622203411.3873.26064@wrigleys.postgresql.org> References: <20150622203411.3873.26064@wrigleys.postgresql.org> Comments: In-reply-to socketpair@gmail.com message dated "Mon, 22 Jun 2015 20:34:11 -0000" Date: Mon, 22 Jun 2015 19:08:28 -0400 Message-ID: <9889.1435014508@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org socketpair@gmail.com writes: > If I use PQputCopyData() to pass parts of the binary protocol (as documented > in http://www.postgresql.org/docs/9.3/static/sql-copy.html ), postgres > binary socket data gets corrupted (i.e. protocol is broken). I think your test program is buggy; specifically, it doesn't appear to have any provision for dealing with data endianness, which means it will not work on a little-endian machine. Per the COPY binary format spec: Headers and data are in network byte order. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs