PostgreSQL 9.0.2. This is a Bug?

From: Fabricio <fabrixio1(at)hotmail(dot)com>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: PostgreSQL 9.0.2. This is a Bug?
Date: 2011-01-14 21:45:13
Message-ID: SNT139-w47258CF257F82755A2EA0FEF30@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

This is a bug?
A developer is writing a function in C code and when he makes some change and replace the old library with the new one and if run CREATE OR REPLACE FUNCTION Postgre crash and restart. After restart CREATE OR REPLACE FUNCTION does not crash postgres, only the first time. He makes a function test.

Function's Sorce code:
#include "postgres.h"
#include "fmgr.h"
#include <sys/utsname.h>

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

PG_FUNCTION_INFO_V1(testfuncion);
Datum testfuncion( PG_FUNCTION_ARGS )
{
int32 iParam01,
iParam02;
char cTexto[30]={0};

iParam01 = PG_GETARG_INT32(0);
iParam02 = PG_GETARG_INT32(1);

sprintf(cTexto, "iParam01: %i iParam02: %i", iParam01, iParam02 );
elog( NOTICE, cTexto );

PG_RETURN_INT32(iParam01 * -1);
}

makefile:

CC = gcc
CFLAGS = -fPIC
CPPFLAGS = -I/usr/include -I/usr/local/pgsql/include/server/ -I/usr/local/include -I./

all:
rm -f *.o
rm -f *.so

$(CC) $(CPPFLAGS) $(CFLAGS) -c -o ./bin/testFuncion.o testFuncion.c
$(CC) $(CFLAGS) $(CPPFLAGS) -shared -o ./bin/testFuncion.so ./bin/testFuncion.o

@cp ./bin/testFuncion.so /somefolder/testFuncion.so

@echo " "
@echo OK ... Compilado ... OK
@echo " "

PostgreSQL' logs:

<2011-01-14 12:52:49 MST 10.43.69.141(55946) somedb someuser 18484 idle 64> DEBUG: StartTransactionCommand
<2011-01-14 12:52:49 MST 10.43.69.141(55946) somedb someuser 18484 idle 65> DEBUG: StartTransaction
<2011-01-14 12:52:49 MST 10.43.69.141(55946) somedb someuser 18484 idle 66> DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
<2011-01-14 12:52:49 MST 10.43.69.141(55946) somedb someuser 18484 idle 67> LOG: statement: CREATE OR REPLACE FUNCTION testfuncion(integer,integer)
RETURNS int AS
'/somefolder/testFuncion.so', 'testfuncion'
LANGUAGE c IMMUTABLE STRICT;

<2011-01-14 12:52:49 MST 10.43.69.141(55946) somedb someuser 18484 CREATE FUNCTION 68> DEBUG: ProcessUtility
<2011-01-14 12:52:49 MST 18297 654> DEBUG: reaping dead processes
<2011-01-14 12:52:49 MST 18297 655> DEBUG: server process (PID 18484) was terminated by signal 11: Segmentation fault
<2011-01-14 12:52:49 MST 18297 656> LOG: server process (PID 18484) was terminated by signal 11: Segmentation fault
<2011-01-14 12:52:49 MST 18297 657> LOG: terminating any other active server processes

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Achilleas Mantzios 2011-01-14 22:18:51 Re: Postgresql 9.0.2 explain analyze very slow (10x), compared to actual query time
Previous Message Kevin Grittner 2011-01-14 21:20:25 Re: Postgresql 9.0.2 explain analyze very slow (10x), compared to actual query time