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 1fuGp7-0006uT-QH for pgsql-general@arkaria.postgresql.org; Mon, 27 Aug 2018 12:40: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 1fuGp5-0007rt-53 for pgsql-general@arkaria.postgresql.org; Mon, 27 Aug 2018 12:40:47 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fuGp4-0007rl-TT for pgsql-general@lists.postgresql.org; Mon, 27 Aug 2018 12:40:46 +0000 Received: from n3.nabble.com ([162.255.23.22]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fuGox-0002VX-86 for pgsql-general@postgresql.org; Mon, 27 Aug 2018 12:40:46 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id AF5AEEC4F271 for ; Mon, 27 Aug 2018 05:40:37 -0700 (MST) Date: Mon, 27 Aug 2018 05:40:37 -0700 (MST) From: TalGloz To: pgsql-general@postgresql.org Message-ID: <1535373637716-0.post@n3.nabble.com> In-Reply-To: <1535371344785-0.post@n3.nabble.com> References: <1535201678396-0.post@n3.nabble.com> <4192.1535211864@sss.pgh.pa.us> <1535212627744-0.post@n3.nabble.com> <15017.1535214682@sss.pgh.pa.us> <1535371344785-0.post@n3.nabble.com> Subject: Re: Returning Vector of Pairs with a PostgreSQL C Extension Function MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk It looks like changing the elements[0] = CStringGetDatum(localT1.c_str()); elements[1] = CStringGetDatum(localT2.c_str()); to: elements[0] = PointerGetDatum(cstring_to_text(localT1.c_str())); elements[1] = PointerGetDatum(cstring_to_text(localT2.c_str())); Solved the problem. If anyone thinks that there is a better way please tell me. Best regards, Tal -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html