Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 39D279FBBAB for ; Mon, 14 May 2007 20:36:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 10860-05 for ; Mon, 14 May 2007 20:35:59 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.228]) by postgresql.org (Postfix) with ESMTP id 459BF9FBBA4 for ; Mon, 14 May 2007 20:35:59 -0300 (ADT) Received: by wr-out-0506.google.com with SMTP id 70so1817792wra for ; Mon, 14 May 2007 16:35:58 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:from:to:cc:references:in-reply-to:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language; b=XW5tR2b8YH/iWGBI3Few3dFVeFKT75orak7kUw1VVQWH3U2sqbp9FWgZuH9cta9OeCBpHM0UVUdHYFYywuAngNCt+VqBuS24OAm+JGvqTaOIK0r22nrDQ+zrj5sQAbWkX4lHzCTE2nhRSNIBtZHxnvo2IJMaTUWypzGjfT60UJU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:from:to:cc:references:in-reply-to:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language; b=klwbwF1Qs0I2AGpjOjwIfDD9aCoFpp6NAGj22gaO1endkgH2mabBBdQBSBFE7PGauLFOj7zm4NHxb/UzmW5GCTQXA2fc8LRpYeOqaMRyWhMPHOUfL/3uDDROand9Kp0jSzjoKInmdXmIeuv9FXyEsPwgQGC86Ck4ShnT44wI/jM= Received: by 10.90.102.20 with SMTP id z20mr5613953agb.1179185758124; Mon, 14 May 2007 16:35:58 -0700 (PDT) Received: from progrobt ( [66.224.81.242]) by mx.google.com with ESMTP id 20sm15665421agd.2007.05.14.16.35.56; Mon, 14 May 2007 16:35:57 -0700 (PDT) From: "Rob Tester" To: "'Gregory Stark'" Cc: "'Alvaro Herrera'" , References: <20070513181154.GB11750@alvh.no-ip.org> <07ec01c79669$25dad7a0$719086e0$@com> <87k5vbx9ti.fsf@oxford.xeocode.com> In-Reply-To: <87k5vbx9ti.fsf@oxford.xeocode.com> Subject: Re: Trouble returning a text field from an SRF Date: Mon, 14 May 2007 16:35:23 -0700 Message-ID: <07ee01c79680$8b674650$a235d2f0$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 thread-index: AceWf9dF2m5Spul2QDWbXwSYLOLj3wAACRnA Content-Language: en-us X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/27 X-Sequence-Number: 6534 Thanks for the tip, I will correct that if I ever get the long strings to be returned. I use BlessTupleDesc() in the first SRF call as the following: BlessTupleDesc(RelationNameGetTupleDesc("testText")); As per a previous email testText is a Type that I created on the server using: CREATE TYPE testText AS (alevel integer, someText text); -----Original Message----- From: Gregory Stark [mailto:stark@enterprisedb.com] Sent: Monday, May 14, 2007 4:30 PM To: Rob Tester Cc: 'Alvaro Herrera'; pgsql-interfaces@postgresql.org Subject: Re: [INTERFACES] Trouble returning a text field from an SRF "Rob Tester" writes: > textOut=palloc(MIN_SIZE*count); > if (textOut){ > strcpy(textOut,"TEST=>"); > for(pointCnt=0;pointCnt if (pointCnt!=0){ > strcat(wktStr,","); > } > sprintf(buffer,"%4.8lf %4.8lf",0.0,0.0); > strcat(textOut,buffer); > } > strcat(wktStr,"==>END"); Fwiw, this isn't the cause of your 64k limit but if you're processing thousands of data points this way you might consider rewriting it without the strcats. As is it's a O(n^2) algorithm. Each time through the loop it'll have to scan the entire string it already has built up (twice even). Instead just keep a pointer to the end of the string and add your stuff there. You can use strcpy and pass it the pointer to the end, or just call sprintf directly on that pointer. > tuple=heap_formtuple(tupDesc, values, nulls); I'm curious about where you got the tupDesc and what it contains. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com