C Function causes backend to die in 7.4.3

Поиск
Список
Период
Сортировка
От Graeme Hinchliffe
Тема C Function causes backend to die in 7.4.3
Дата
Msg-id 1094132569.6790.23.camel@office-137.zen.co.uk
обсуждение исходный текст
Ответы Re: C Function causes backend to die in 7.4.3  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hiya,
    I have written a C function for postgres.  I developed and got this
function working on postgres 7.3.2, however the production system was
7.4.3.

On my initial dev setup it worked perfectly, however on the 7.4.3 it
caused the backend to terminate abnormaly!, I upgraded my dev system to
be the same version to ensure it wasn't just the production box, and
sure enough the function now also fails on my dev system!

I have commented out the entire function body looking for the cause of
the crash, and it seems that it is being cause by calling
PointerGetDatum() on the return.  If I set return to NULL, then the
insert on the table doesn't cause a crash of the backend.

Any ideas?  The C segment for my code on 7.4.3 which is crashing is as
follows:

extern Datum updatetrig(PG_FUNCTION_ARGS);

PG_FUNCTION_INFO_V1(updatetrig);

Datum updatetrig(PG_FUNCTION_ARGS)
{
  TriggerData *trigdata = (TriggerData *) fcinfo->context;
  char *name;
  char *data;  // Temporary string
  char *ptr;   // Temp string for building

  char *sql;  // The SQL statement to add the update row
  char *id;   // The id of the row the update is for
  char *idfield;  // The field name of the id column
  char *table; // The name of the table being modified
  char *action; // The action undertaken by the update
  char *update; // The update SQL itself

  int noatts=0;  // Number of attributes
  int len=0;    // Length of string needed
  int a=0;

  HeapTuple rettuple;

  // Commented out code is here

  return PointerGetDatum(rettuple);
}

thanks for any help

--
-----
Graeme Hinchliffe (BSc)
Core Internet Systems Designer
Zen Internet (http://www.zen.co.uk/)

Direct: 0845 058 9074
Main  : 0845 058 9000
Fax   : 0845 058 9005



В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: plpgsql function
Следующее
От: Tom Lane
Дата:
Сообщение: Re: zombie primary key lurches out of database to devour the brains of the unwary