At Sat, 21 May 2005 10:30:47 -0400,
Tom Lane wrote:
> BTW, a more future-proof way of doing what you want:
> 
> > [...]
> 
> is to let the varchar output routine do it:
> 
>      Datum text_datum = PG_GETARG_DATUM(0);
>      char *text;
> 
>      text = DatumGetCString(DirectFunctionCall1(varcharout, text_datum));
> 
> This avoids assuming that you know the internal representation of
> varchar (and if you think that's frozen for eternity, you haven't been
> reading the discussions of ramping up our locale support...)

Thanks for all those hints!  I've now adapted my code as you recommended
and it works fine, although I'm not certain what DirectFunctionCall1 and
DatumGetCString actually do (it seems that the only documentation of
these functions is in the source code, and I'm too lazy to sift through
it at the moment).

-- 
Felix E. Klee

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to