Search Postgresql Archives

Re: Problems converting between C string and Datum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Jack Orenstein" <jack.orenstein@xxxxxxxxx> 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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux