Re: Problems converting between C string and Datum - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Problems converting between C string and Datum
Date
Msg-id 20060920192947.GD7888@svana.org
Whole thread Raw
In response to Problems converting between C string and Datum  ("Jack Orenstein" <jack.orenstein@gmail.com>)
List pgsql-general
On Wed, Sep 20, 2006 at 11:19:29AM -0400, Jack Orenstein wrote:
> Thanks for all your help with the memory management problems. Next
> problem: I'm having problems converting from a char* to a Datum and back
> again.
>
> I have a char* which I need as a Datum, for use with a plan returned
> from SPI_prepare, so I'm doing this:

<snip>

They look OK. For examples see the PG_STR_GET_TEXT() and
PG_TEXT_GET_STR() macros in utils/adt/varlena.c.

> This crashes doing the ereport:
>
>    psql:test.sql:23: server closed the connection unexpectedly
>         This probably means the server terminated abnormally
>        before or while processing the request.

Obviously something is going wrong. Perhaps you should enable coredumps
and use gdb to examine them, or attach gdb to the running backend to
catch the error.

> 2) Is there some neater way to generate debug output than ereport(WARNING,
> ...)?
> The output is quite verbose, e.g.

Try elog(), but the details are also controlled by the client also,
perhaps you can reduce the verbosity there also?

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: Jeff Davis
Date:
Subject: Re: 8.2: select from an INSERT returning?
Next
From: CSN
Date:
Subject: Selecting from two unrelated tables