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 1gj9US-0007Vn-S4 for pgsql-general@arkaria.postgresql.org; Mon, 14 Jan 2019 21:09:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gj9UQ-0007z7-1p for pgsql-general@arkaria.postgresql.org; Mon, 14 Jan 2019 21:09:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gj9UP-0007uL-Mu for pgsql-general@lists.postgresql.org; Mon, 14 Jan 2019 21:09:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gj9UM-0005Dk-Az for pgsql-general@postgresql.org; Mon, 14 Jan 2019 21:09:43 +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 x0EL9fPw023706; Mon, 14 Jan 2019 16:09:41 -0500 From: Tom Lane To: Michel Pelletier cc: pgsql-general@postgresql.org Subject: Re: Question about MemoryContextRegisterResetCallback In-reply-to: References: <9801.1547400642@sss.pgh.pa.us> Comments: In-reply-to Michel Pelletier message dated "Mon, 14 Jan 2019 10:56:10 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23704.1547500181.1@sss.pgh.pa.us> Date: Mon, 14 Jan 2019 16:09:41 -0500 Message-ID: <23705.1547500181@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michel Pelletier writes: > It mentions "on disk" does this mean the flattened representation must be > binary compatible with what matrix_send emits? They will likely be the > same now, so I can see this as a convenience, but is it a requirement? No, your on-the-wire representation for send/recv can be different from what you put on-disk. In fact, typically I'd recommend that it *should* be different to some extent, to insulate COPY BINARY data from internal representation choices and simplify any client code that might look at the "binary" format. See for example numeric_send/recv, which don't just transmit the internal format as-is --- and that was a good thing because it let us implement various storage optimizations over the years without breaking COPY BINARY compatibility. It's also a good idea to try to make the on-the-wire representation independent of server endianness and alignment rules. The point of the comment you're looking at is that the "flat" varlena representation that you have to translate to/from is the same as what will be on-disk if the datum gets stored someplace. regards, tom lane