By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,640 Members | 2,094 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

Backup and restore

P: 51
Can I back up all stored procedures and triggers on a database?
Sep 27 '10 #1
Share this Question
Share on Google+
5 Replies


Expert 100+
P: 700

P: 51
Thank you for your suggestion,rski. I did read the pg_dump document. Just can't find exact way to do it. Finally I figure out such as following.
"pg_dump -T *.* mydb >mydb.sql"

Well which will produce a script. After delete schema creation statements and replace "create function" with "create and replace function", it becomes exactly what I needed. I'm a developer. I used a lot of stored procedures in my application for customers. After a version update, I need to upgrade customer's database without touch their data. It will be too hard to pick up every updated sp to upgrade. Instead, I think the easy way to do is just reinstall all sp. That's why I need the exact way to backup all sp.
Sep 28 '10 #3

Expert 100+
P: 700
Don't you keep you stored procedures in a files (probably in some versioning system like cvs)?
If you do, I do not understand why do you want to get sp definitions from database?

But if you need that i think you need to write a script that will go through pg_proc table and read sp definitions.
Sep 28 '10 #4

P: 51
Thank you for reply. Would you be able to recommend a simple versioning system? Thank you again!
Sep 29 '10 #5

Expert 100+
P: 700
The most popular I think are CVS, SVN and GIT
Sep 29 '10 #6

Post your reply

Sign in to post your reply or Sign up for a free account.