On Tue, Dec 04, 2007 at 09:26:46AM -0600, Glen W. Mabey wrote: > On Tue, Dec 04, 2007 at 09:10:21AM -0600, Pavel Stehule wrote: > > use macro DatumGetPointer(datum) > > When I do that, I get the following compiler warning: > > warning: assignment from incompatible pointer type Well yes, you're getting a (void*) which you need to cast to a (text*). It's the generic cast for indirect types. > Using DatumGetPointer also seg faults ... What actually segfault? Not DatumGetPointer() since that's just a cast. > Is there somewhere that I am not adequately checking for an error? Depends what you're doing. Remember, a (text*) is a varlena object so you need to use the VAR_DATA,VAR_LEN macros to access it. The string is not nul-terminated for example. If you want to get a plain C-string, use textout or DatumToCString or something similar. However, DETOAST is the right step, because if you don't do that you might be handed a toasted string. Have a nice day, -- Martijn van Oosterhout <kleptog@xxxxxxxxx> http://svana.org/kleptog/ > Those who make peaceful revolution impossible will make violent revolution inevitable. > -- John F Kennedy
Attachment:
signature.asc
Description: Digital signature