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

Lists: pgsql-hackers
From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Why can't I use pgxs to build a plpgsql plugin?
Date: 2012-04-08 08:59:55
Message-ID: 1333875595.2325.14.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why can't I use pgxs to build a plpgsql plugin?
Date: 2012-04-12 09:28:51
Message-ID: 4F86A053.6030202@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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 Content-Type Size
install-plpgsql-header-file-1.patch text/x-diff 1016 bytes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why can't I use pgxs to build a plpgsql plugin?
Date: 2012-04-12 13:59:43
Message-ID: 1481.1334239183@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)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


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why can't I use pgxs to build a plpgsql plugin?
Date: 2012-04-12 16:28:44
Message-ID: 4F8702BC.10906@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 12.04.2012 16:59, Tom Lane wrote:
> Heikki Linnakangas<heikki(dot)linnakangas(at)enterprisedb(dot)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


From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why can't I use pgxs to build a plpgsql plugin?
Date: 2012-04-13 16:17:33
Message-ID: 1334333853.4776.0.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why can't I use pgxs to build a plpgsql plugin?
Date: 2012-04-16 10:09:09
Message-ID: 4F8BEFC5.6010906@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why can't I use pgxs to build a plpgsql plugin?
Date: 2012-04-16 19:53:20
Message-ID: 1334606000.2237.7.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why can't I use pgxs to build a plpgsql plugin?
Date: 2012-04-17 04:56:13
Message-ID: CAFj8pRC5JhDtcpGfxJq1mxOjY-8rgPubtHP4t16NAhRpU9CQOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2012/4/16 Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why can't I use pgxs to build a plpgsql plugin?
Date: 2012-04-17 06:36:04
Message-ID: 4F8D0F54.2070801@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 17.04.2012 07:56, Pavel Stehule wrote:
> 2012/4/16 Heikki Linnakangas<heikki(dot)linnakangas(at)enterprisedb(dot)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


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why can't I use pgxs to build a plpgsql plugin?
Date: 2012-04-17 07:12:41
Message-ID: CAFj8pRCstqjgwBvQBmv-agqEY=jm8Mqn9=qAOgk1WUuBBaOM2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2012/4/17 Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>:
> On 17.04.2012 07:56, Pavel Stehule wrote:
>>
>> 2012/4/16 Heikki Linnakangas<heikki(dot)linnakangas(at)enterprisedb(dot)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