pg.ddx.io pgsql-admin@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Diffs between two databases... 2+ messages / 2 participants [nested] [flat]
* Diffs between two databases... @ 2005-11-18 13:47 Mario Splivalo <mario.splivalo@mobart.hr> 0 siblings, 1 reply; 2+ messages in thread From: Mario Splivalo @ 2005-11-18 13:47 UTC (permalink / raw) To: pgsql-admin I have a production server (7.4.9) with, of course, a production database with 30 tables, 250 functions, types, views, indices, ... My developers have created new version of the software, that includes the new version of the datbase. They've changed 6 tables, two dozen views and almost one hundred stored procedures. Now I need to apply those changes on the production server. Is there a way to generate a 'diff' script for the two databases? I'd write script myself if I'd be able to 'script' just the desired object. For instance, just the function. I've seen that I can do pg_dump to a file with pg_dump -Fc, and then I can do pg_restore -Fc -l <dump.file> to have the list of all the database objects. There I can see the functions, but how do I (re)create just the desired function? What would suit me the best would be a tool/util that would drop each db.object into a separate file. Then I could create a script wich will 'load' each object from the file when I want it (so I don't have dependency problems). Is there a tool like that, or should I stick with pg_dump/pg_restore, or maybe even going trough information_schema to see all the objects in the database? Mario -- Mario Splivalo Mob-Art mario.splivalo@mobart.hr "I can do it quick, I can do it cheap, I can do it well. Pick any two." ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Diffs between two databases... @ 2005-11-18 17:34 Alvaro Herrera <alvherre@commandprompt.com> parent: Mario Splivalo <mario.splivalo@mobart.hr> 0 siblings, 0 replies; 2+ messages in thread From: Alvaro Herrera @ 2005-11-18 17:34 UTC (permalink / raw) To: Mario Splivalo <mario.splivalo@mobart.hr>; +Cc: pgsql-admin Mario Splivalo wrote: > I've seen that I can do pg_dump to a file with pg_dump -Fc, and then I > can do pg_restore -Fc -l <dump.file> to have the list of all the > database objects. There I can see the functions, but how do I (re)create > just the desired function? Use pg_restore -L. > What would suit me the best would be a tool/util that would drop each > db.object into a separate file. Then I could create a script wich will > 'load' each object from the file when I want it (so I don't have > dependency problems). I think you could use the "tar" method (-Ft option to pg_dump) and extract the body of each element from the generated dump. Treat it as a standard tar archive. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-11-18 17:34 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2005-11-18 13:47 Diffs between two databases... Mario Splivalo <mario.splivalo@mobart.hr> 2005-11-18 17:34 ` Alvaro Herrera <alvherre@commandprompt.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox