Search Postgresql Archives

Missing magic block

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to learn how to write custom extensions to postgres so wrote a
basic C function to see how it works.  However, I keep getting the following
error "Missing magic block" when I try to add the function to the database.
According to the documentation in the manual, all I need to do is add the
following: 

#include "server/fmgr.h"

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

To my C file and it will work.  However, I guess it is not working?  Below
is the source code:

#include "server/postgres.h"
#include <string.h>

#include "server/fmgr.h"

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif
         
int
add_one(int arg)
{
    return arg + 1;
}

And the sql statement I am using is:

CREATE FUNCTION add_one(IN int)
	RETURNS int
	AS 'add_one'
	LANGUAGE C;

Any feedback as to how to correct it is appreciated!
Thanks,
Brad



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux