Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0kCv-0001ZN-OZ for pgsql-general@arkaria.postgresql.org; Tue, 06 Jul 2021 12:29:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m0kCu-0005Jz-NY for pgsql-general@arkaria.postgresql.org; Tue, 06 Jul 2021 12:29:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0kCu-0005Hn-E6 for pgsql-general@lists.postgresql.org; Tue, 06 Jul 2021 12:29:44 +0000 Received: from wforward2-smtp.messagingengine.com ([64.147.123.31]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0kCs-0006KG-BQ for pgsql-general@lists.postgresql.org; Tue, 06 Jul 2021 12:29:43 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailforward.west.internal (Postfix) with ESMTP id 241571AC02F8; Tue, 6 Jul 2021 08:29:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 06 Jul 2021 08:29:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=VZVQX1ZPspT0sbGjL23zJqHb+rbrnqixD9XOHsuwB SY=; b=oKFYPyAiIUmkHl7jGoyzkC3cnHwnTM2I/xu35rw6pF5HmkYz+DmqWKoR+ ugLuNfyUzwqhsdEzV/R/JrNsPe09+EOfLPyg2ezOTlij6NTIkjrC7GpjnJPPpFV0 WkjSFZ0XG0/eC6eJeJ/EGVdWw48612L8j+2O6hlqUKZBnw0EvU9bBl3bPkg+zSsl SCCfu/OLgDNhqQIO7Q2zGIFjpkMW6u10LYFwp7/pYG/dIQPcQqDOks6bTeH7EYtG J47Cuvr6wQ98eZSRIwn1WSy8eKgDVmvuiJ/CzsO8/T0QYO1OISlRUPes8A6yCnZU iNSsepb00m577XotQPFBVe4ZanTuA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrtddtgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthekre dttdefjeenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdr vghishgvnhhtrhgruhhtsegvnhhtvghrphhrihhsvggusgdrtghomheqnecuggftrfgrth htvghrnhepkeehieehvdegueeghfffueeliedvgfeigffhheevvdegfefgfeetgeejudej jeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepph gvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 6 Jul 2021 08:29:38 -0400 (EDT) Subject: Re: Question about how to handle numeric (decimal) data types while using libpq To: Sudheer H R , pgsql-general@lists.postgresql.org References: <63A4A360-8A41-476B-A5B6-D00088D6F590@tekenlight.com> From: Peter Eisentraut Message-ID: Date: Tue, 6 Jul 2021 14:29:37 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <63A4A360-8A41-476B-A5B6-D00088D6F590@tekenlight.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 06.07.21 13:04, Sudheer H R wrote: > I am trying to use libpq for interfacing with PostgreSQL from a C/C++ based application. > > I have tried to use binary format of data for both sending and receiving data to and from server (resultFormat = 1). > > As I understand most binary types, int, float etc… are encoded in bing-endian byte order and they can be converted to appropriate host specific memory representations. > > However NUMERIC datatype is a more complex structure with multiple ints and pointers. > > I would like to know if there are published library functions that convert (to and from) NUMERIC field to say, long double datatype There is a third-party library called libpqtypes out there that adds support for handling specific types on the libpq side. But I'm not sure how up to date it is.