From: Gregory Stark <stark@enterprisedb.com>
To: Rob Tester <robtester@gmail.com>
Cc: 'Alvaro Herrera' <alvherre@commandprompt.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Trouble returning a text field from an SRF
Date: Tue, 15 May 2007 00:30:17 +0100
Message-ID: <87k5vbx9ti.fsf@oxford.xeocode.com> (raw)
In-Reply-To: <07ec01c79669$25dad7a0$719086e0$@com>
References: <f5f60fb50705120826q7e08c426offc9268bb776e8b6@mail.gmail.com>
<20070513181154.GB11750@alvh.no-ip.org>
<07ec01c79669$25dad7a0$719086e0$@com>
"Rob Tester" <robtester@gmail.com> writes:
> textOut=palloc(MIN_SIZE*count);
> if (textOut){
> strcpy(textOut,"TEST=>");
> for(pointCnt=0;pointCnt<count;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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: stark@enterprisedb.com, robtester@gmail.com, alvherre@commandprompt.com
Subject: Re: Trouble returning a text field from an SRF
In-Reply-To: <87k5vbx9ti.fsf@oxford.xeocode.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox