From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
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 17:41:11 |
Message-ID: | 11671.1158774071@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Jack Orenstein" <jack(dot)orenstein(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-09-20 17:42:59 | Re: 8.2: select from an INSERT returning? |
Previous Message | Jeff Davis | 2006-09-20 16:42:51 | 8.2: select from an INSERT returning? |