문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 dba.stackexchange
scroll top