Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id D8B0D9FBB51 for ; Mon, 14 May 2007 20:30:32 -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 08736-03 for ; Mon, 14 May 2007 20:30:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from oxford.xeocode.com (unknown [87.127.95.194]) by postgresql.org (Postfix) with ESMTP id 90AF29FBB22 for ; Mon, 14 May 2007 20:30:21 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=oxford.xeocode.com) by oxford.xeocode.com with esmtp (Exim 4.67) (envelope-from ) id 1Hnjze-0001iD-6c; Tue, 15 May 2007 00:30:18 +0100 From: Gregory Stark To: "Rob Tester" Cc: "'Alvaro Herrera'" , Subject: Re: Trouble returning a text field from an SRF In-Reply-To: <07ec01c79669$25dad7a0$719086e0$@com> (Rob Tester's message of "Mon, 14 May 2007 13:47:52 -0700") Organization: EnterpriseDB References: <20070513181154.GB11750@alvh.no-ip.org> <07ec01c79669$25dad7a0$719086e0$@com> X-Draft-From: ("nnimap+mail01.enterprisedb.com:INBOX.interfaces" 26) Date: Tue, 15 May 2007 00:30:17 +0100 Message-ID: <87k5vbx9ti.fsf@oxford.xeocode.com> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/26 X-Sequence-Number: 6533 "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