Search Postgresql Archives

Re: crosstab function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>>> "Martin" == Martin Mueller <martinmueller@xxxxxxxxxxxxxxxx> writes:

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

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

 Martin> CREATE EXTENSION IF NOT EXISTS tablefunc;

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

CREATE EXTENSION causes the functions to be defined in the current
database; that's the only "import" that is needed. In psql, you can do
this:

\df+ *.crosstab*

to see what functions of that name are defined and what schema they are
in (should be "public" by default). Likewise  \dx  lists installed
extensions in the current database.

Remember that you need to do the CREATE EXTENSION command actually in
the database in which you want to use the functions, not in any other
database.

Errors about functions not existing are usually caused by a problem with
the number or type of parameters, since function names aren't unique
(overloaded functions are allowed). You didn't tell us the actual error
you got, so we can't say exactly what the problem is there.

-- 
Andrew (irc:RhodiumToad)





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux