Re: more docs on extending postgres in C

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: more docs on extending postgres in C
Date: 2010-01-22 17:12:42
Message-ID: 20100122181242.0f679f5a@dawn.webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 22 Jan 2010 11:02:46 -0500
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it> writes:
> > If I had to build stuff in the pg source tree I'd just clone a
> > contrib directory and change the makefile [1]. What am I
> > supposed to do if I'd like to create a contrib elsewhere (eg.
> > ~/Documents/nfs/projects/ts_extensions)?
>
> Use PGXS:
> http://www.postgresql.org/docs/8.4/static/xfunc-c.html#XFUNC-C-PGXS
>
> If the docs aren't enough for you, all of the contrib modules can
> be built via pgxs, using "make PGXS=1". So their makefiles are
> useful examples.

What did work for me on Debian sid was:

- installing postgresql-server-dev-[version]
- apt-get source postgresql-server-dev-[version]
- copy from there a contrib dir in my ~ (or wherever you prefer)
- export USE_PGXS=1; make

I didn't have postgresql server installed on this box but I have
stuff that got in to satisfy dependencies for php/python pg drivers
and psql.
I wasn't able to understand from where PGXS pick up the version
since I installed -dev-8.3 but everything else was for 8.4 and it
didn't work:

ivan(at)dawn:~/ts_extension$ export USE_PGXS=1; make
Makefile:12: /usr/lib/postgresql/8.4/lib/pgxs/src/makefiles/pgxs.mk:
No such file or directory make: *** No rule to make target
`/usr/lib/postgresql/8.4/lib/pgxs/src/makefiles/pgxs.mk'. Stop.

Installing dev-8.4 made everything work.

Nothing that really trouble me... but I'd expect that installing
-dev-8.3 it would look in the right place since actually pgxs.mk is
included in both versions.

Thanks... I'd publish a summary as soon as I've clearer ideas so
that the next poor guy will find easier to write contrib on Debian.

I don't know if the version problem is worth a bug report to Debian
(or pg people that built the pgxs system).

--
Ivan Sergio Borgonovo
http://www.webthatworks.it

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andy Colson 2010-01-22 17:17:19 Re: ISO guidelines/strategies to guard injection attacks
Previous Message DM 2010-01-22 17:10:48 Re: Fragmentation/Vacuum, Analyze, Re-Index