Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iAfce-0006qR-4Y for pgsql-general@arkaria.postgresql.org; Wed, 18 Sep 2019 19:28:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iAfcc-0001PH-J8 for pgsql-general@arkaria.postgresql.org; Wed, 18 Sep 2019 19:28:14 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iAfcc-0001P0-5s for pgsql-general@lists.postgresql.org; Wed, 18 Sep 2019 19:28:14 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iAfcY-0006fx-Jw for pgsql-general@lists.postgresql.org; Wed, 18 Sep 2019 19:28:13 +0000 Received: by mail-pf1-x444.google.com with SMTP id y72so619911pfb.12 for ; Wed, 18 Sep 2019 12:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=illuminatedcomputing-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=s4SdiCMdqSfjFWVmexeaAgKFBi6g6bo/cN3fsaAR+BU=; b=IL2ueYbSQz6XUWX2S9pr3YTiSZOyauGA+nQLKC8ypz4JTenZgWxoMqfWKaBDflIYP9 oJHNPGilrjrJzDM40tpqjDXPdMHllaIwew6yq1rwfTo5YoO07OeLaqpaVDqn7/dsQ6Z2 yYjU6/4wLD5ObQsamYNSoDKqkx/7ZzBsUF25veaySmHr3Vz9jgkDH1jOrJf4TJoCfATg XNDijhWnytNWI6j/CE0+7PlBatzQrP1bdFW3rdBGfvwRISx68HfWGon8st01u09Rnh2o E80zPZIHcPVX/km9eHnq4UBwbEHRAcQRjCE2ZeADr0fP/YqSAccN2xU1N/7xBjb5d1sq ix4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=s4SdiCMdqSfjFWVmexeaAgKFBi6g6bo/cN3fsaAR+BU=; b=IjGCx2JNWiJYF7GBvHOEsO4bhBlrvoPm9e4z+5SolxF2UnavoYu7FwQzIzch0ZiDyU XvMhYRLoWbyu3rPDdVjH7eTmtNzchmgH4NXYhZB/gQNy/S+U6EXqoknxJDjBj7Jk4Olo 9zgts3ml5cbsclqGqWOOoUrxBsGVMzOT8a9pd5lNFBdTYN9Gy4l2pwF8eF6+9smVldOE UvpNyOS+EkMFGe3o+i2JArUX69GZ6meMklmo/jaq/vk2A3yHvJo29R3WgWWRQy6uqGhs KdW3GDPp0AK+TlYuR7km1niqdBBSpSKjq7x1HdM4R4ZMgZDhD+lQ9KFsFBrNdPzgPgpX VK9Q== X-Gm-Message-State: APjAAAXEE/8IgW4PmbxBZj+Er0+QeZL2jkzYQTwLH1a2K2icYcgOagpZ yVNJhRLRBDWUQDeeOJtBHu7DFpfUcXM= X-Google-Smtp-Source: APXvYqwC3ogOdHEt95m+rawxDziLsL0BjNlbVewA/NSNiBeYy0Vos4TCC69iqWyQhcXgrtV9AFj+iQ== X-Received: by 2002:aa7:851a:: with SMTP id v26mr6223836pfn.11.1568834887930; Wed, 18 Sep 2019 12:28:07 -0700 (PDT) Received: from [192.168.2.101] (static-50-53-109-254.bvtn.or.frontiernet.net. [50.53.109.254]) by smtp.googlemail.com with ESMTPSA id l6sm3527967pje.28.2019.09.18.12.28.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2019 12:28:07 -0700 (PDT) Subject: Re: When does Postgres use binary I/O? To: Tom Lane Cc: pgsql-general@lists.postgresql.org References: <24378.1568816806@sss.pgh.pa.us> From: Paul Jungwirth Message-ID: Date: Wed, 18 Sep 2019 12:28:06 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <24378.1568816806@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 9/18/19 7:26 AM, Tom Lane wrote: > The core regression tests don't systematically exercise binary I/O, > and they certainly wouldn't magically cover a new type they didn't > use to. You'd need to add test case(s). Thanks! I thought psql might use binary IO internally when available, or at least pg_dump with its custom format, but it looks like neither of those are true---and now that I think about it I suppose the code in adt isn't something they would be able to use, so it makes sense. So I guess my choices are to use COPY WITH (FORMAT BINARY) or write something that calls PQexecParams. Does anything else use binary I/O? > Likely it'd be good to have some more consistent approach to > testing that ... right now it's not even very obvious where > is a good place to add such tests. I do see a small test in > src/test/regress/input/misc.source (COPY BINARY stud_emp), > but that solution doesn't scale easily because of its > dependence on absolute file pathnames. I'm not sure how hard this would be, but we could add a new schema to the regression db and then do something like this: psql -d regression -c 'COPY public.t TO STDOUT WITH (FORMAT BINARY)' \ | psql -d regression -c 'COPY binaryio.t FROM STDIN WITH (FORMAT BINARY)' and then verify that `SELECT *` looks the same for the two tables. I can think of several complications already though. :-) But even if that's not an automated test at least it gives me an easy way to manually exercise my own multirange_{send,recv} functions. Thanks! -- Paul ~{:-) pj@illuminatedcomputing.com