Re: crosstab function

Поиск
Список
Период
Сортировка
От Ron
Тема Re: crosstab function
Дата
Msg-id be0eedb1-4c01-4c30-1d66-2dffe4b78ef2@gmail.com
обсуждение исходный текст
Ответ на crosstab function  (Martin Mueller <martinmueller@northwestern.edu>)
Список pgsql-general
On 2/26/19 7:51 PM, Martin Mueller wrote:

I run Postgres 10.5.  I understand that there is something called tablefunc and it includes a crosstab function. On Stack Overflow I learn that you import this function. But from where and how?  The Postgres documentation is quite clear and intelligible to a retired English professor like me, but there is nothing in the Postgres documentation about how to do the import, and a search for ‘import modules’ yields nothing.

 

I tried to emulate a Stack overflow query that does what I want to do, but got an error message saying that the crosstab function doesn’t exist. I tried

 

CREATE EXTENSION IF NOT EXISTS tablefunc;

 

but it did nothing. It doesn’t seem to work  as import statements in Python do


Extensions are short bits of sql that create functions for you, and point to "shared object" executable files.  Quite literally, it's extending postgres.

Thus, the actual executable file needs to be somewhere on the computer's hard drive (specifically, where Postgres expects it to be for your OS).

In the Linux world, for example, there's typically a package you install named something like postgresql96-contrib-9.6.9-blahblah.rpm.  You'd install that using the OS' package manager, restart postgres and then CREATE EXTENSION should work.

You'll have to determine whether PostgreApp comes with "contribs".  If not, you'll have to use another source for Pg, like MacPorts.

--
Angular momentum makes the world go 'round.

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: crosstab function
Следующее
От: Ron
Дата:
Сообщение: Re: crosstab function