Re: Can we modify 'text *' passed to a C function? - Mailing list pgsql-hackers

From m w
Subject Re: Can we modify 'text *' passed to a C function?
Date
Msg-id 20010206015421.43033.qmail@web12404.mail.yahoo.com
Whole thread Raw
In response to Re: Can we modify 'text *' passed to a C function?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
--- Tom Lane <tgl@sss.pgh.pa.us> wrote:
> m w <mttf2000@yahoo.com> writes:
> > If I write a function that does a 'tolower()' on
> each
> > character of a parameter passed into my function,
> do I
> > have to allocate a new text object and initialize
> it
> > and copy the data, or can I modify that object in
> > place and return it?
> 
> You must NEVER alter a pass-by-reference parameter,
> of text or
> any other data type.  If you do, you are probably
> altering data
> in a disk buffer, thus changing the content of a
> tuple.

Thanks, I was concerned that may be the case, but I
could never find a definitive answer on this.

__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump data integrity & java
Next
From: "Christopher Kings-Lynne"
Date:
Subject: RE: Re: PostgreSQL -> PHP problem