Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1frlX7-0003M7-0P for pgsql-general@arkaria.postgresql.org; Mon, 20 Aug 2018 14:51:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1frlX4-0007ol-Qy for pgsql-general@arkaria.postgresql.org; Mon, 20 Aug 2018 14:51:50 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1frlX4-0007oe-FY for pgsql-general@lists.postgresql.org; Mon, 20 Aug 2018 14:51:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1frlX2-0003Rb-5W for pgsql-general@postgresql.org; Mon, 20 Aug 2018 14:51:49 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w7KEpjBB006566; Mon, 20 Aug 2018 10:51:45 -0400 From: Tom Lane To: Luca Ferrari cc: pgsql-general Subject: Re: help defining a basic type operator In-reply-to: References: Comments: In-reply-to Luca Ferrari message dated "Mon, 20 Aug 2018 16:40:21 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19615.1534776705.1@sss.pgh.pa.us> Date: Mon, 20 Aug 2018 10:51:45 -0400 Message-ID: <19616.1534776705@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Luca Ferrari writes: > I'm trying to define a custom data type that would represent a number > of bytes in a lossy human way. You did not show us the SQL definition of the type. I don't see anything obviously wrong in what you showed (other than hfsize_add not setting the result's scaling), so the problem is somewhere else. Given this C declaration, the type probably needs to be size 16, double alignment, pass-by-reference; maybe you messed up part of that? > HFSize *sum = new_HFSize(); What is new_HFSize? regards, tom lane