1

I'm trying to create a function on my Heroku database. I'll eventually tie it to a trigger.

I've seen the error all over, but I can't seem to see a way around it.

The error I get is...

rake aborted!
PG::Error: ERROR:  language "plpgsql" does not exist

What I'm reading is that I can't create triggers or functions on heroku. Unless I go with the shared_database, which is not an option. My app is already multi-tenanted, and makes use of it's own schemas.

I attempted to create the language as suggested, but that is denied.

Question: Am I reading things right, can one create functions in postgesql on heroku?
Question: If one can make functions in the database, then does anyone know how?

2
  • You're using the shared database, right? I have lots of functions and triggers defined in a dedicated Heroku database. Commented Jun 4, 2012 at 1:26
  • turns out I am indeed using the shared. Most confusing, because I am able to create different schemas.. Or I was in the past. Commented Jun 4, 2012 at 2:07

1 Answer 1

5

Since PostgreSQL 9.0 the procedural language PL/pgSQL is pre-installed. On earlier versions you have to run:

CREATE LANGUAGE plpgsql;

once per database. Heroku shared may still be PostgreSQL 8.3. More in the fine manual.

However, the old "shared" plan does not allow plpgsql, as far as I have heard (don't use it myself). There is a new plan with PostgreSQL 9.1 , supporting plpgsql, though.

Sign up to request clarification or add additional context in comments.

2 Comments

I can confirm the basic heroku plan does not let you do "CREATE language plpgsql"
@anka: Double quotes are not needed for plpgsql here. Try the fine manual.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.