Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > Custom C functi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 23 Topic 15452 of 16159
Post > Topic >>

Custom C function - is palloc broken?

by n8thatcher@[EMAIL PROTECTED] ("Nathan Thatcher") May 3, 2008 at 09:39 PM

First off, I am developing custom c functions for PostgreSQL 8.3 in
Windows (sorry... not my choice). It appears that there is some
underlying problem in the server that is causing a runtime error to
crash the server when I use palloc. For example... I run the
following:

PG_FUNCTION_INFO_V1(add_one);
Datum
add_one(PG_FUNCTION_ARGS)
{
	int32		arg = PG_GETARG_INT32(0);
	PG_RETURN_INT32(arg + 1);
}

and it works just fine. NOTE: this is directly from the tutorial
directory. Now, when I add a palloc statement in there it crashes:


PG_FUNCTION_INFO_V1(add_one);
Datum
add_one(PG_FUNCTION_ARGS)
{
	int32		arg = PG_GETARG_INT32(0);
	palloc(sizeof(Point));
	PG_RETURN_INT32(arg + 1);
}

Running "SELECT add_one(1);" crashes the server. The logs show this:

2008-05-03 21:29:08 MDT LOG:  server process (PID 3008) was terminated
by exception 0xC0000005
2008-05-03 21:29:08 MDT HINT:  See C include file "ntstatus.h" for a
description of the hexadecimal value.
2008-05-03 21:29:08 MDT LOG:  terminating any other active server
processes
2008-05-03 21:29:08 MDT LOG:  all server processes terminated;
reinitializing
2008-05-03 21:29:09 MDT FATAL:  pre-existing shared memory block is still
in use
2008-05-03 21:29:09 MDT HINT:  Check if there are any old server
processes still running, and terminate them.

I also get the exact same error when I try to run either the copytext
or concat_text functions from the same funcs_new.c file in the
tutorial directory. This essentially means that I cannot write any
UDFs that require memory allocation or text parameters. Heron seems to
be experiencing the same thing. Is this a bug in 8.3? Can anyone help?

-- 
Sent via pgsql-general mailing list (pgsql-general@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
 




 23 Posts in Topic:
Custom C function - is palloc broken?
n8thatcher@[EMAIL PROTECT  2008-05-03 21:39:04 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-04 23:50:26 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-04 23:52:41 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-04 13:02:49 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-05 05:53:27 
Re: Custom C function - is palloc broken?
magnus@[EMAIL PROTECTED]   2008-05-04 21:15:49 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-05 06:47:11 
Re: Custom C function - is palloc broken?
n8thatcher@[EMAIL PROTECT  2008-05-04 21:53:01 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-05 15:54:13 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 09:26:22 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 16:57:08 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 18:47:50 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-06 08:42:16 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 19:42:01 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-06 10:19:32 
Re: Custom C function - is palloc broken?
tgl@[EMAIL PROTECTED] (T  2008-05-05 22:32:11 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-06 12:02:28 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 20:45:05 
Re: Custom C function - is palloc broken?
jd@[EMAIL PROTECTED] (&q  2008-05-05 20:18:42 
Re: Custom C function - is palloc broken?
tgl@[EMAIL PROTECTED] (T  2008-05-05 22:22:43 
Re: Custom C function - is palloc broken?
magnus@[EMAIL PROTECTED]   2008-05-05 09:07:37 
Re: Custom C function - is palloc broken?
dpage@[EMAIL PROTECTED]   2008-05-06 09:46:14 
Re: Custom C function - is palloc broken?
dpage@[EMAIL PROTECTED]   2008-05-06 09:48:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Thu Jul 24 1:48:43 CDT 2008.