6

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.

  • Can you be more specific? WHat do you mean by "generating scripts for all functions"? – DrColossos Sep 10 '11 at 9:48
  • 1
    @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
3

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...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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