(我估计大家也都看得懂,我还是在下面谢了大体意思~)
You can't tell pg_dump to dump only functions. However, you can make a dump without data (-s) and filter it on restoring. Note the -Fc part: this will produce a file suitable for pg_restore.
译:我们不能使用pg_dump工具单独导出存储过程。但是,可以先把所有的模式结构都导出来,然后恢复的时候指定只恢复存储过程。注意-Fc选项的意思:生成一个可供pg_restore使用的文件。
First take the dump:
译:首先导出:
[gpadmin@master ~]$pg_dump -U username -Fc -s -f dump_test your_database
Then create a list of the functions:
译:创建一个包含所有函数的文件:
[gpadmin@master ~]$pg_restore -l dump_test | grep FUNCTION > function_list
And finally restore them (-L specifies the list file created above):
译:最后用-L参数指定上面创建的函数文件来恢复:
[gpadmin@master ~]$pg_restore -U username -d your_other_database -L function_list dump_test