Re: Problems converting between C string and Datum

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Jack Orenstein <jack(dot)orenstein(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problems converting between C string and Datum
Date: 2006-09-20 19:29:47
Message-ID: 20060920192947.GD7888@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message CSN 2006-09-20 19:49:00 Selecting from two unrelated tables
Previous Message Jeff Davis 2006-09-20 19:04:18 Re: 8.2: select from an INSERT returning?