pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fabricio <fabrixio1@hotmail.com>
To: pgsql-admin@postgresql.org
Subject: PostgreSQL 9.0.2. This is a Bug?
Date: Fri, 14 Jan 2011 14:45:13 -0700
Message-ID: <SNT139-w47258CF257F82755A2EA0FEF30@phx.gbl> (raw)








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


 		 	   		  =

view thread (4+ messages)  latest in thread

Message-ID: <SNT139-w47258CF257F82755A2EA0FEF30@phx.gbl>
Permalink:  ../SNT139-w47258CF257F82755A2EA0FEF30@phx.gbl/
Also on:    postgresql.org/message-id/SNT139-w47258CF257F82755A2EA0FEF30@phx.gbl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: fabrixio1@hotmail.com
  Subject: Re: PostgreSQL 9.0.2. This is a Bug?
  In-Reply-To: <SNT139-w47258CF257F82755A2EA0FEF30@phx.gbl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox