From: | Gregory Stark <stark(at)enterprisedb(dot)com> |
---|---|
To: | "Rob Tester" <robtester(at)gmail(dot)com> |
Cc: | "'Alvaro Herrera'" <alvherre(at)commandprompt(dot)com>, <pgsql-interfaces(at)postgresql(dot)org> |
Subject: | Re: Trouble returning a text field from an SRF |
Date: | 2007-05-14 23:30:17 |
Message-ID: | 87k5vbx9ti.fsf@oxford.xeocode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
"Rob Tester" <robtester(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Rob Tester | 2007-05-14 23:35:23 | Re: Trouble returning a text field from an SRF |
Previous Message | Rob Tester | 2007-05-14 21:23:41 | Re: Trouble returning a text field from an SRF |