Thread: Why can't I use pgxs to build a plpgsql plugin?

Why can't I use pgxs to build a plpgsql plugin?

From
Guillaume Lelarge
Date:
Hi,

I recently wrote a plpgsql plugin. I wanted to enable the use of pgxs,
to make it easier to compile the plugin, but I eventually found that I
can't do that because the plpgsql.h file is not available in the include
directory.

I'm wondering if we shouldn't put the header files of plpgsql source
code in the include directory. It would help compiling the PL/pgsql
debugger, and profiler (and of course my own plugin).

There could be a good reason which would explain why we can't (or don't
want to) do this, but I don't see it right now.

Thanks.

Regards.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: Why can't I use pgxs to build a plpgsql plugin?

From
Heikki Linnakangas
Date:
On 08.04.2012 11:59, Guillaume Lelarge wrote:
> Hi,
>
> I recently wrote a plpgsql plugin. I wanted to enable the use of pgxs,
> to make it easier to compile the plugin, but I eventually found that I
> can't do that because the plpgsql.h file is not available in the include
> directory.
>
> I'm wondering if we shouldn't put the header files of plpgsql source
> code in the include directory. It would help compiling the PL/pgsql
> debugger, and profiler (and of course my own plugin).

Yep, I just bumped into this myself, while trying to make pldebugger
module compilable with pgxs.

> There could be a good reason which would explain why we can't (or don't
> want to) do this, but I don't see it right now.

Me neither, except a general desire to keep internals hidden. I propose
the attached.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

Attachment

Re: Why can't I use pgxs to build a plpgsql plugin?

From
Tom Lane
Date:
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> On 08.04.2012 11:59, Guillaume Lelarge wrote:
>> There could be a good reason which would explain why we can't (or don't
>> want to) do this, but I don't see it right now.

> Me neither, except a general desire to keep internals hidden. I propose 
> the attached.

Shouldn't the new targets be marked .PHONY?
        regards, tom lane


Re: Why can't I use pgxs to build a plpgsql plugin?

From
Heikki Linnakangas
Date:
On 12.04.2012 16:59, Tom Lane wrote:
> Heikki Linnakangas<heikki.linnakangas@enterprisedb.com>  writes:
>> On 08.04.2012 11:59, Guillaume Lelarge wrote:
>>> There could be a good reason which would explain why we can't (or don't
>>> want to) do this, but I don't see it right now.
>
>> Me neither, except a general desire to keep internals hidden. I propose
>> the attached.
>
> Shouldn't the new targets be marked .PHONY?

Umm ... <me reads up on what .PHONY means> ... yes, yes they should.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


Re: Why can't I use pgxs to build a plpgsql plugin?

From
Guillaume Lelarge
Date:
On Thu, 2012-04-12 at 12:28 +0300, Heikki Linnakangas wrote:
> On 08.04.2012 11:59, Guillaume Lelarge wrote:
> > Hi,
> >
> > I recently wrote a plpgsql plugin. I wanted to enable the use of pgxs,
> > to make it easier to compile the plugin, but I eventually found that I
> > can't do that because the plpgsql.h file is not available in the include
> > directory.
> >
> > I'm wondering if we shouldn't put the header files of plpgsql source
> > code in the include directory. It would help compiling the PL/pgsql
> > debugger, and profiler (and of course my own plugin).
> 
> Yep, I just bumped into this myself, while trying to make pldebugger 
> module compilable with pgxs.
> 
> > There could be a good reason which would explain why we can't (or don't
> > want to) do this, but I don't see it right now.
> 
> Me neither, except a general desire to keep internals hidden. I propose 
> the attached.
> 

Sounds good to me. I would love to see this happening in 9.2.

Thanks, Heikki.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: Why can't I use pgxs to build a plpgsql plugin?

From
Heikki Linnakangas
Date:
On 13.04.2012 19:17, Guillaume Lelarge wrote:
> On Thu, 2012-04-12 at 12:28 +0300, Heikki Linnakangas wrote:
>> On 08.04.2012 11:59, Guillaume Lelarge wrote:
>>> There could be a good reason which would explain why we can't (or don't
>>> want to) do this, but I don't see it right now.
>>
>> Me neither, except a general desire to keep internals hidden. I propose
>> the attached.
>
> Sounds good to me. I would love to see this happening in 9.2.

Ok, committed. I fixed the .PHONY line as Tom pointed out, and changed 
MSVC install.pm to also copy the header file.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


Re: Why can't I use pgxs to build a plpgsql plugin?

From
Guillaume Lelarge
Date:
On Mon, 2012-04-16 at 13:09 +0300, Heikki Linnakangas wrote:
> On 13.04.2012 19:17, Guillaume Lelarge wrote:
> > On Thu, 2012-04-12 at 12:28 +0300, Heikki Linnakangas wrote:
> >> On 08.04.2012 11:59, Guillaume Lelarge wrote:
> >>> There could be a good reason which would explain why we can't (or don't
> >>> want to) do this, but I don't see it right now.
> >>
> >> Me neither, except a general desire to keep internals hidden. I propose
> >> the attached.
> >
> > Sounds good to me. I would love to see this happening in 9.2.
> 
> Ok, committed. I fixed the .PHONY line as Tom pointed out, and changed 
> MSVC install.pm to also copy the header file.
> 

Thanks.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: Why can't I use pgxs to build a plpgsql plugin?

From
Pavel Stehule
Date:
2012/4/16 Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>:
> On 13.04.2012 19:17, Guillaume Lelarge wrote:
>>
>> On Thu, 2012-04-12 at 12:28 +0300, Heikki Linnakangas wrote:
>>>
>>> On 08.04.2012 11:59, Guillaume Lelarge wrote:
>>>>
>>>> There could be a good reason which would explain why we can't (or don't
>>>> want to) do this, but I don't see it right now.
>>>
>>>
>>> Me neither, except a general desire to keep internals hidden. I propose
>>> the attached.
>>
>>
>> Sounds good to me. I would love to see this happening in 9.2.
>
>
> Ok, committed. I fixed the .PHONY line as Tom pointed out, and changed MSVC
> install.pm to also copy the header file.
>

Hello,

it doesn't work for modules from contrib directory

pavel ~/src/postgresql/contrib/check_plpgsql $ make
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -fexcess-precision=standard -g -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE   -c -o check_plpgsql.o
check_plpgsql.c
check_plpgsql.c:16:21: fatal error: plpgsql.h: No such file or directory
compilation terminated.


Regards

Pavel

>
> --
>  Heikki Linnakangas
>  EnterpriseDB   http://www.enterprisedb.com
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers


Re: Why can't I use pgxs to build a plpgsql plugin?

From
Heikki Linnakangas
Date:
On 17.04.2012 07:56, Pavel Stehule wrote:
> 2012/4/16 Heikki Linnakangas<heikki.linnakangas@enterprisedb.com>:
>> Ok, committed. I fixed the .PHONY line as Tom pointed out, and changed MSVC
>> install.pm to also copy the header file.
>
> Hello,
>
> it doesn't work for modules from contrib directory
>
> pavel ~/src/postgresql/contrib/check_plpgsql $ make
> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
> -Wdeclaration-after-statement -Wendif-labels
> -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
> -fwrapv -fexcess-precision=standard -g -fpic -I. -I.
> -I../../src/include -D_GNU_SOURCE   -c -o check_plpgsql.o
> check_plpgsql.c
> check_plpgsql.c:16:21: fatal error: plpgsql.h: No such file or directory
> compilation terminated.

Hmm, the makefile rule I added copies the plpgsql.h file to 
include/server directory when you do "make install". That makes the file 
available when you build with USE_PGXS=1, without access to the source 
tree, but doesn't change the situation when you build inside contrib.

If you plop the module directly to contrib, I guess you'll have to do

CFLAGS += -I$(top_srcdir)/src/pl/plpgsql/src

That's what pldebugger has always done.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


Re: Why can't I use pgxs to build a plpgsql plugin?

From
Pavel Stehule
Date:
2012/4/17 Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>:
> On 17.04.2012 07:56, Pavel Stehule wrote:
>>
>> 2012/4/16 Heikki Linnakangas<heikki.linnakangas@enterprisedb.com>:
>>>
>>> Ok, committed. I fixed the .PHONY line as Tom pointed out, and changed
>>> MSVC
>>> install.pm to also copy the header file.
>>
>>
>> Hello,
>>
>> it doesn't work for modules from contrib directory
>>
>> pavel ~/src/postgresql/contrib/check_plpgsql $ make
>> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
>> -Wdeclaration-after-statement -Wendif-labels
>> -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
>> -fwrapv -fexcess-precision=standard -g -fpic -I. -I.
>> -I../../src/include -D_GNU_SOURCE   -c -o check_plpgsql.o
>> check_plpgsql.c
>> check_plpgsql.c:16:21: fatal error: plpgsql.h: No such file or directory
>> compilation terminated.
>
>
> Hmm, the makefile rule I added copies the plpgsql.h file to include/server
> directory when you do "make install". That makes the file available when you
> build with USE_PGXS=1, without access to the source tree, but doesn't change
> the situation when you build inside contrib.
>
> If you plop the module directly to contrib, I guess you'll have to do
>
> CFLAGS += -I$(top_srcdir)/src/pl/plpgsql/src
>
> That's what pldebugger has always done.
>

ook, thank you

Pavel

> --
>  Heikki Linnakangas
>  EnterpriseDB   http://www.enterprisedb.com