Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y5h3g-0005d9-73 for pgsql-interfaces@arkaria.postgresql.org; Mon, 29 Dec 2014 20:36:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y5h3f-0003iX-JG for pgsql-interfaces@arkaria.postgresql.org; Mon, 29 Dec 2014 20:36:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y5h3e-0003iQ-Ez for pgsql-interfaces@postgresql.org; Mon, 29 Dec 2014 20:36:54 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y5h3b-00067l-1b for pgsql-interfaces@postgresql.org; Mon, 29 Dec 2014 20:36:52 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 1C7B020BCB for ; Mon, 29 Dec 2014 15:36:50 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Mon, 29 Dec 2014 15:36:50 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=kleppmann.com; h= x-sasl-enc:from:content-type:content-transfer-encoding:subject :message-id:date:to:mime-version; s=mesmtp; bh=oRgw8KS+99w5VDRqL FiGFYzj5cU=; b=dMetqk5ERQxCaz/ESnq6KOK8Ih97ozguCZz6eq3Qf3Lc/pAHi 86dDLXRF/GsabeNRKBtKfnVF/O7AhWHwBKLnUxI4RGjLtYHFhU2/9N0Ug24JNOt6 y0/+OgduvWPhM+PDHf9hJ02tT3IWnUV9L+V6Akqvce2/Q8QwG/wa2OBEIc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:from:content-type :content-transfer-encoding:subject:message-id:date:to :mime-version; s=smtpout; bh=oRgw8KS+99w5VDRqLFiGFYzj5cU=; b=aok 5BF/AZ8OQnZog7rG6g9c70c2EYwOeykOyR7j8C9hMd2juL5GM5aQ9Oo++QfS9VBA /3kqSn32Pk3S4S7dNylVclq944CING8mtXGPI1J53c/dYNOJd9vcr5pDZVoxtU4R BCc7NT0vDEuZR26ceWHIPkU/ew8Hd9tQH88/mgMs= X-Sasl-enc: oK5K4FE04BEzo1HCODElVeUglDuurQgPy09mHF/ck+52 1419885409 Received: from [192.168.2.111] (unknown [79.245.120.194]) by mail.messagingengine.com (Postfix) with ESMTPA id 69B0BC0027D for ; Mon, 29 Dec 2014 15:36:49 -0500 (EST) From: Martin Kleppmann Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Access to receive/output functions from libpq client Message-Id: Date: Mon, 29 Dec 2014 21:36:46 +0100 To: pgsql-interfaces@postgresql.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) X-Mailer: Apple Mail (2.1878.6) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-interfaces Precedence: bulk Sender: pgsql-interfaces-owner@postgresql.org Hi, I'm trying to export the contents of a PG database to an external format, u= sing 9.4's exciting new logical decoding facility. I am currently writing a= n output plugin for logical replication (using PGXS). To capture a snapshot= of the data before the replication slot was created, I am using libpq to s= et up a transaction with the replication slot's exported snapshot, and doin= g a "select * from table". In this context, my question is about decoding datatypes. An output plugin = sees the changed tuples in binary format, it can find the the OID of a datu= m, and use PG's functions to decode the datum -- for example, it can use Da= tumGetNumeric() to get a Numeric struct, and it can use OidOutputFunctionCa= ll() to get the text representation of a datum. That's very nice. In the external client, when doing PQsendQueryParams() I can choose between= binary and text result format. I'd like to be able to request the binary f= ormat and use the same conversion functions as in the output plugin. This w= ould allow the data to be exported in a structured representation, and only= falling back to using a datatype's output function to get a string represe= ntation if we don't know what to do with a particular OID. My problem is that the libpq client doesn't have access to the same library= functions as the output plugin. The linker complains about undefined symbo= ls _OidOutputFunctionCall, _getTypeOutputInfo and _pg_detoast_datum, for ex= ample. Is there a library that I could link into the libpq client to provide the f= unctions for decoding binary datatypes? Or is there some other recommended = way of decoding binary datums in a client? Thanks, Martin --=20 Sent via pgsql-interfaces mailing list (pgsql-interfaces@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-interfaces