Обсуждение: How to include Tablefunc as an extension

Поиск
Список
Период
Сортировка

How to include Tablefunc as an extension

От
Stefan Schwarzer
Дата:

Hello,

 

I read through the Postgres doc and many Google results, but it seems still unclear to me how to include additional packages into my postgres database. I see that there are a few installed under "/usr/local/pgsql-9.1/share/extension/" (I am on Lion and installed the Kyngchaos libs). But as I want to install crosstab now, I downloaded the source code for postgres, run a make/install - and now wonder what to do with it. I could eventually load the .sql file as usual; but it seems this should be now avoided, and loaded as an extension. I tried to copy three files (--1.0.sql, --unpackaged.sql and the normal .sql) to the folder and then load it from PgAdmin, but this results in an error message ("could not access file "$libdir/tablefunc"").

 

Thanks for any hints!

Re: How to include Tablefunc as an extension

От
"Tomas Vondra"
Дата:
On 18 Červen 2012, 16:29, Stefan Schwarzer wrote:
> Hello,
>
>
>
> I read through the Postgres doc and many Google results, but it seems
> still unclear to me how to include additional packages into my postgres
> database. I see that there are a few installed under
> "/usr/local/pgsql-9.1/share/extension/" (I am on Lion and installed the
> Kyngchaos libs). But as I want to install crosstab now, I downloaded the
> source code for postgres, run a make/install - and now wonder what to do
> with it. I could eventually load the .sql file as usual; but it seems this
> should be now avoided, and loaded as an extension. I tried to copy three
> files (--1.0.sql, --unpackaged.sql and the normal .sql) to the folder and
> then load it from PgAdmin, but this results in an error message ("could
> not access file "$libdir/tablefunc"").

This should do the trick:

CREATE EXTENSION crosstab;


T.


Re: How to include Tablefunc as an extension

От
Chris Travers
Дата:
On Mon, Jun 18, 2012 at 7:36 AM, Tomas Vondra <tv@fuzzy.cz> wrote:
> On 18 Červen 2012, 16:29, Stefan Schwarzer wrote:
>> Hello,
>>
>>
>>
>> I read through the Postgres doc and many Google results, but it seems
>> still unclear to me how to include additional packages into my postgres
>> database. I see that there are a few installed under
>> "/usr/local/pgsql-9.1/share/extension/" (I am on Lion and installed the
>> Kyngchaos libs). But as I want to install crosstab now, I downloaded the
>> source code for postgres, run a make/install - and now wonder what to do
>> with it. I could eventually load the .sql file as usual; but it seems this
>> should be now avoided, and loaded as an extension. I tried to copy three
>> files (--1.0.sql, --unpackaged.sql and the normal .sql) to the folder and
>> then load it from PgAdmin, but this results in an error message ("could
>> not access file "$libdir/tablefunc"").
>
CREATE EXTENSION tablefunc;

(we use connectby() in LedgerSMB 1.3)

Best Wishes,
Chris Travers

Re: How to include Tablefunc as an extension

От
Stefan Schwarzer
Дата:
>> I read through the Postgres doc and many Google results, but it seems
>> still unclear to me how to include additional packages into my postgres
>> database. I see that there are a few installed under
>> "/usr/local/pgsql-9.1/share/extension/" (I am on Lion and installed the
>> Kyngchaos libs). But as I want to install crosstab now, I downloaded the
>> source code for postgres, run a make/install - and now wonder what to do
>> with it. I could eventually load the .sql file as usual; but it seems this
>> should be now avoided, and loaded as an extension. I tried to copy three
>> files (--1.0.sql, --unpackaged.sql and the normal .sql) to the folder and
>> then load it from PgAdmin, but this results in an error message ("could
>> not access file "$libdir/tablefunc"").
>
> This should do the trick:
>
> CREATE EXTENSION crosstab;

Thanks a lot. Yes, that's the command I used when it launches the above error message. The question is more about:
"wheredo I need to place the tablefunc files (and which ones) in order to execute successfully that command"? 

Thanks for any hints.

Re: How to include Tablefunc as an extension

От
Hitoshi Harada
Дата:
On Mon, Jun 18, 2012 at 11:34 PM, Stefan Schwarzer
<stefan.schwarzer@unep.org> wrote:
>
>>> I read through the Postgres doc and many Google results, but it seems
>>> still unclear to me how to include additional packages into my postgres
>>> database. I see that there are a few installed under
>>> "/usr/local/pgsql-9.1/share/extension/" (I am on Lion and installed the
>>> Kyngchaos libs). But as I want to install crosstab now, I downloaded the
>>> source code for postgres, run a make/install - and now wonder what to do
>>> with it. I could eventually load the .sql file as usual; but it seems this
>>> should be now avoided, and loaded as an extension. I tried to copy three
>>> files (--1.0.sql, --unpackaged.sql and the normal .sql) to the folder and
>>> then load it from PgAdmin, but this results in an error message ("could
>>> not access file "$libdir/tablefunc"").
>>
>> This should do the trick:
>>
>> CREATE EXTENSION crosstab;
>
> Thanks a lot. Yes, that's the command I used when it launches the above error message. The question is more about:
"wheredo I need to place the tablefunc files (and which ones) in order to execute successfully that command"? 

make install should copy files including $libdir/tablefunc.  If not,
you should take a look at the output of the make command.  Make sure
your PATH points to pg_config that your database is running with.

Thanks,
--
Hitoshi Harada

Re: How to include Tablefunc as an extension

От
Stefan Schwarzer
Дата:
>>>> I read through the Postgres doc and many Google results, but it seems
>>>> still unclear to me how to include additional packages into my postgres
>>>> database. I see that there are a few installed under
>>>> "/usr/local/pgsql-9.1/share/extension/" (I am on Lion and installed the
>>>> Kyngchaos libs). But as I want to install crosstab now, I downloaded the
>>>> source code for postgres, run a make/install - and now wonder what to do
>>>> with it. I could eventually load the .sql file as usual; but it seems this
>>>> should be now avoided, and loaded as an extension. I tried to copy three
>>>> files (--1.0.sql, --unpackaged.sql and the normal .sql) to the folder and
>>>> then load it from PgAdmin, but this results in an error message ("could
>>>> not access file "$libdir/tablefunc"").
>>>
>>> This should do the trick:
>>>
>>> CREATE EXTENSION crosstab;
>>
>> Thanks a lot. Yes, that's the command I used when it launches the above error message. The question is more about:
"wheredo I need to place the tablefunc files (and which ones) in order to execute successfully that command"? 
>
> make install should copy files including $libdir/tablefunc.  If not,
> you should take a look at the output of the make command.  Make sure
> your PATH points to pg_config that your database is running with.

I do as indicated in Kyngchaos ReadMe file:

    export PATH="/usr/local/pgsql-9.1/bin:$PATH"
    export USE_PGXS=1
    make
    sudo make install


Problem is that when I run the install, it shows this:

    Makefile:19: ../../src/Makefile.global: No such file or directory
    Makefile:20: /contrib/contrib-global.mk: No such file or directory
    make: *** No rule to make target `/contrib/contrib-global.mk'.  Stop.

And this, after looking around, seem to indicate that I need to configure the Postgres source code. But there, with:

    ./configure --with-openssl --with-pam --with-krb5 --with-gssapi --with-ldap --enable-thread-safety --with-bonjour
--with-python--without-perl --enable-nls --with-libxml CFLAGS=-Os x86_64 LD=gcc LDLFAGS=-arch x86_64 

I run into another problem:

    configure: WARNING: you should use --build, --host, --target
    configure: WARNING: you should use --build, --host, --target
    checking build system type... x86_64-pc-none
    checking host system type... x86_64-pc-none
    checking which template to use... configure: error:
    *******************************************************************
    PostgreSQL has apparently not been ported to your platform yet.

Thanks for any hints how to solve that riddle!

Re: How to include Tablefunc as an extension

От
Tom Lane
Дата:
Stefan Schwarzer <stefan.schwarzer@unep.org> writes:
> I do as indicated in Kyngchaos ReadMe file:

>     export PATH="/usr/local/pgsql-9.1/bin:$PATH"
>     export USE_PGXS=1
>     make
>     sudo make install

I'm beginning to wonder who are Kyngchaos and whether they are competent
at all.  They obviously didn't test the above advice.  It does not work
because sudo clears environment variables (at least for me on OS X
Lion).  You could possibly do this instead:

    sudo make USE_PGXS=1 install

It would still be running without the custom PATH setting, but likely
you don't need that for the install step.

> Problem is that when I run the install, it shows this:

>     Makefile:19: ../../src/Makefile.global: No such file or directory
>     Makefile:20: /contrib/contrib-global.mk: No such file or directory
>     make: *** No rule to make target `/contrib/contrib-global.mk'.  Stop.

> And this, after looking around, seem to indicate that I need to
> configure the Postgres source code.

No, if you got through the "make" part, you have configure info.
It's just failing to propagate to the make install inside sudo.

            regards, tom lane

Re: How to include Tablefunc as an extension

От
Stefan Schwarzer
Дата:
>> I do as indicated in Kyngchaos ReadMe file:
>
>>    export PATH="/usr/local/pgsql-9.1/bin:$PATH"
>>    export USE_PGXS=1
>>    make
>>    sudo make install
>
> I'm beginning to wonder who are Kyngchaos and whether they are competent
> at all.  They obviously didn't test the above advice.  It does not work
> because sudo clears environment variables (at least for me on OS X
> Lion).  You could possibly do this instead:
>
>     sudo make USE_PGXS=1 install
>
> It would still be running without the custom PATH setting, but likely
> you don't need that for the install step.

A thousand thanks!! This seems to work. At least, it copied the files over to /usr/local/pgsql-9.1/share/extension/.
Unfortunately,I can't yet check the integration of the extension into my database, as my database doesn't want to start
up(see my other mail from this morning).  

Thanks so much!