Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using pgAdmin version 1.10.5, and I've checked the properties and menu options but couldn't find anything on the subject.

For example, I just want to generate a script that includes the functions that I've created for my schema. If I right click on the database node and choose backup it has an option to create a script for the schema, but it creates all the objects. And I want only the functions.

share|improve this question
Can you be more specific? WHat do you mean by "generating scripts for all functions"? – DrColossos Sep 10 '11 at 9:48
@DrColossos' answer should be what you needed. Also, if you can, install a more recent version of pgAdmin. There have been numerous improvements since v1.10. The current version is 1.14. – Erwin Brandstetter Nov 10 '11 at 23:23
up vote 3 down vote accepted

There is no explicit switch to just export functions. I did some research since it's a nice question.

I can think of some ways to do this:

  • Using pgAdmin, you get the code that makes up the function when you right-click on the function, and choose "Scripts->Ceate". You could copy&paste the contens and put it into a sql file that you can import like any other file
  • Exporting the schema and importing only the functions you need (tedious, since you need the exact name and arguments of the function. This blog post explains it:

    pg_dump -Fc -s | pg_restore -P 'funcname(args)'

  • Do some querying in the schema/pg_proc and export the results. This could be another function that just exports the functions...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.