Re: Can we modify 'text *' passed to a C function?

From: m w <mttf2000(at)yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Can we modify 'text *' passed to a C function?
Date: 2001-02-06 01:54:21
Message-ID: 20010206015421.43033.qmail@web12404.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

--- Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> m w <mttf2000(at)yahoo(dot)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/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2001-02-06 01:55:22 RE: Re: PostgreSQL -> PHP problem
Previous Message Tom Lane 2001-02-06 01:28:36 Re: pg_dump data integrity & java