pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Martin Mueller <martinmueller@northwestern.edu>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: crosstab function
Date: Wed, 27 Feb 2019 02:07:49 +0000
Message-ID: <875zt6f0pp.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <3B0E0069-18FC-476D-90A1-5201891AA52C@northwestern.edu>
References: <3B0E0069-18FC-476D-90A1-5201891AA52C@northwestern.edu>

>>>>> "Martin" == Martin Mueller <martinmueller@northwestern.edu> 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)




view thread (23+ messages)  latest in thread

Message-ID: <875zt6f0pp.fsf@news-spur.riddles.org.uk>
Permalink:  ../875zt6f0pp.fsf@news-spur.riddles.org.uk/
Also on:    postgresql.org/message-id/875zt6f0pp.fsf@news-spur.riddles.org.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: andrew@tao11.riddles.org.uk, martinmueller@northwestern.edu
  Subject: Re: crosstab function
  In-Reply-To: <875zt6f0pp.fsf@news-spur.riddles.org.uk>
  References: <3B0E0069-18FC-476D-90A1-5201891AA52C@northwestern.edu> <875zt6f0pp.fsf@news-spur.riddles.org.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox