Thread: Location for external scripts for Extensions?

Location for external scripts for Extensions?

From
Josh Berkus
Date:
All,

pg_partman has several external (python) scripts which help the
extension, located in /extras/ in its source.  The problem currently is
that if you install pg_partman via pgxn or package, you don't get those
scripts, because there's no "install" location for them.

Where should these go?  PGSHARE/pg_partman/?  Or somewhere else? I'm
looking to set a canonical location for extensions with external scripts.

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com



Re: Location for external scripts for Extensions?

From
Dimitri Fontaine
Date:
Josh Berkus <josh@agliodbs.com> writes:
> pg_partman has several external (python) scripts which help the
> extension, located in /extras/ in its source.  The problem currently is
> that if you install pg_partman via pgxn or package, you don't get those
> scripts, because there's no "install" location for them.

See also my proposal to solve that, I'd welcome some design level
discussions about it:
 http://www.postgresql.org/message-id/m28uyzgof3.fsf@2ndQuadrant.fr

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support



Re: Location for external scripts for Extensions?

From
Josh Berkus
Date:
Dimitri,

> Josh Berkus <josh(at)agliodbs(dot)com> writes:
>> pg_partman has several external (python) scripts which help the
>> extension, located in /extras/ in its source.  The problem currently is
>> that if you install pg_partman via pgxn or package, you don't get those
>> scripts, because there's no "install" location for them.
> 
> See also my proposal to solve that, I'd welcome some design level
> discussions about it:
> 
>   http://www.postgresql.org/message-id/m28uyzgof3.fsf@2ndQuadrant.fr

Well, that's a bit more complicated than what I had in mind.  I was
thinking just a location like $PGSHARE/extensions/lib/

Note that, in the case of pg_partman, we're talking about external
scripts designed to be run by hand, not libaries to be called by the PL
functions.

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com



Re: Location for external scripts for Extensions?

From
Christopher Browne
Date:
On Wed, Oct 23, 2013 at 12:24 PM, Josh Berkus <josh@agliodbs.com> wrote:
> Dimitri,
>
>> Josh Berkus <josh(at)agliodbs(dot)com> writes:
>>> pg_partman has several external (python) scripts which help the
>>> extension, located in /extras/ in its source.  The problem currently is
>>> that if you install pg_partman via pgxn or package, you don't get those
>>> scripts, because there's no "install" location for them.
>>
>> See also my proposal to solve that, I'd welcome some design level
>> discussions about it:
>>
>>   http://www.postgresql.org/message-id/m28uyzgof3.fsf@2ndQuadrant.fr
>
> Well, that's a bit more complicated than what I had in mind.  I was
> thinking just a location like $PGSHARE/extensions/lib/
>
> Note that, in the case of pg_partman, we're talking about external
> scripts designed to be run by hand, not libaries to be called by the PL
> functions.

I suppose that Slony would be a possible other user of this facility...

It has something of a mixture of things that get added:

a) There are the functions and tables that it adds.

Ideally, these could be added in via CREATE EXTENSION, so that
it would be somewhat logical for them to live in $PGSHARE/extensions.
(I think that's somewhat tough to do using the CREATE EXTENSION
facility as currently constituted as the slony schema installation process,
at present, does a number of remappings, putting FQ names inside
functions and such.)

b) Then there are the crucial programs that it uses, slon
(replication daemon) and slonik (configuration tool).

Those seem to fit well with your intent; they are additional programs
(not scripts per se, but I don't think that contradicts) that need to
live somewhere reasonably near to the database installation.

By default, we stow slon/slonik in the same directory as is used
by all the other PostgreSQL binaries (e.g. - psql, pg_ctl, ...),
e.g. - $BINDIR

Perhaps that is an OK place for pg_partman.  It would seem
pretty acceptable to me to consider declaring something like
$PGSHARE/extensions/bin for such things.
-- 
When confronted by a difficult problem, solve it by reducing it to the
question, "How would the Lone Ranger handle this?"



Re: Location for external scripts for Extensions?

From
Peter Eisentraut
Date:
On 10/22/13, 2:27 PM, Josh Berkus wrote:
> pg_partman has several external (python) scripts which help the
> extension, located in /extras/ in its source.  The problem currently is
> that if you install pg_partman via pgxn or package, you don't get those
> scripts, because there's no "install" location for them.

Use the SCRIPTS variable in pgxs, and they will get installed.




Re: Location for external scripts for Extensions?

From
Josh Berkus
Date:
On 10/24/2013 02:36 PM, Peter Eisentraut wrote:
> On 10/22/13, 2:27 PM, Josh Berkus wrote:
>> pg_partman has several external (python) scripts which help the
>> extension, located in /extras/ in its source.  The problem currently is
>> that if you install pg_partman via pgxn or package, you don't get those
>> scripts, because there's no "install" location for them.
> 
> Use the SCRIPTS variable in pgxs, and they will get installed.
> 

Oh yeah?  Cool.  Is there an existing extension with an example of this?

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com



Re: Location for external scripts for Extensions?

From
Peter Eisentraut
Date:
On 10/24/13, 5:37 PM, Josh Berkus wrote:
> On 10/24/2013 02:36 PM, Peter Eisentraut wrote:
>> On 10/22/13, 2:27 PM, Josh Berkus wrote:
>>> pg_partman has several external (python) scripts which help the
>>> extension, located in /extras/ in its source.  The problem currently is
>>> that if you install pg_partman via pgxn or package, you don't get those
>>> scripts, because there's no "install" location for them.
>>
>> Use the SCRIPTS variable in pgxs, and they will get installed.
>>
> 
> Oh yeah?  Cool.  Is there an existing extension with an example of this?

Don't know.  I just saw this in the pgxs source code.  Presumably, it
was added because it was used somewhere.