"Jack Orenstein" <jack.orenstein@gmail.com> writes:
> I have a char* which I need as a Datum, for use with a plan returned
> from SPI_prepare, so I'm doing this:
> char* string;
> Datum d;
> ...
> d = DirectFunctionCall1(textin, CStringGetDatum(string));
> ...
> ereport(WARNING, (errmsg("string: %s",
> DatumGetCString(DirectFunctionCall1(textout, d)))));
That looks OK as far as it goes, so I speculate the problem is in
something you didn't show us.
> This crashes doing the ereport:
If you are doing backend C code you should certainly learn how to use
gdb to narrow things down more than that. A stack trace would be much
more informative than "server closed the connection unexpectedly".
regards, tom lane