From: | "Felix E(dot) Klee" <felix(dot)klee(at)inka(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Exception Handling in C-Language Functions? |
Date: | 2005-05-21 20:02:00 |
Message-ID: | 87wtpspcuf.wl%felix.klee@inka.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Sabino Mullane | 2005-05-22 13:45:08 | GnuPG / PGP signed checksums for PostgreSQL 8.0.2 |
Previous Message | Jim C. Nasby | 2005-05-21 18:14:43 | Re: table synonyms |