Re: - Mailing list pgsql-general

From Tom Lane
Subject Re:
Date
Msg-id 26707.1333553493@sss.pgh.pa.us
Whole thread Raw
In response to  (Vincas Dargis <vindrg@gmail.com>)
List pgsql-general
Vincas Dargis <vindrg@gmail.com> writes:
> I am experimenting with user defined functions in C, though I have
> problem with stability.

The only obvious problem in what you posted is

>        command = "SELECT 1";
> ...
>        pfree(command);

pfree'ing a constant is pretty much guaranteed to crash.
I am guessing the reason you don't see "5" printed is that
the if() fails, though it's not obvious why.

More generally, instead of putting an elog every two lines,
I'd suggest expending the effort to learn to use a debugger.
Having something that actually traps at the point of a crash
is a lot more useful than trying to triangulate on the problem
between inserted prints.

            regards, tom lane

pgsql-general by date:

Previous
From: Jon Nelson
Date:
Subject: Re: views, queries, and locks
Next
From: leaf_yxj
Date:
Subject: Questions of the privileges to use the pg_cancel_backend and pg_terminate_backend function. Thanks.