Is returning a pointer to the input safe in every case ?

--strk;

Mon, 23 Aug 2004 18:55:21 +0200
strk <strk@keybit.net>
returning modified input from C functions
strk <strk@keybit.net> writes:
> Is returning a pointer to the input safe in every case ?

You mean for returning *unmodified* input, don't you?

Yes, that's safe.  Scribbling on input values is definitely never safe.

			regards, tom lane

Mon, 23 Aug 2004 15:20:09 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: returning modified input from C functions 
On Mon, Aug 23, 2004 at 03:20:09PM -0400, Tom Lane wrote:
> strk <strk@keybit.net> writes:
> > Is returning a pointer to the input safe in every case ?
> 
> You mean for returning *unmodified* input, don't you?
> 
> Yes, that's safe.  Scribbling on input values is definitely never safe.
> 
> 			regards, tom lane

I meant scribbling actually.
Would PG_DETOAST_DATUM_COPY() make it safe then ?

--strk;


Tue, 24 Aug 2004 08:50:00 +0200
strk <strk@keybit.net>
Re: returning modified input from C functions
strk <strk@keybit.net> writes:
> I meant scribbling actually.
> Would PG_DETOAST_DATUM_COPY() make it safe then ?

Yup, that's what it's for.

			regards, tom lane

Tue, 24 Aug 2004 03:21:11 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: returning modified input from C functions 