Re: Database Comparison tool?

From: "Roger Hand" <rhand(at)ragingnet(dot)com>
To: "Rick Gigger" <rick(at)alpinenetworking(dot)com>, "Philippe Ferreira" <phil(dot)f(at)worldonline(dot)fr>
Cc: "Nicholas Walker" <nick(at)howsmymusic(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Database Comparison tool?
Date: 2006-02-10 07:27:19
Message-ID: DB28E9B548192448A4E8C8A3C1B1E475FC3285@sj1-exch-01.us.corp.kailea.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a script I've been using that does a db comparison, and it works very well.

In order to ensure things are in the right order, I have to ...

- query for table and view names (FROM pg_tables WHERE schemaname = 'public' ...), with an ORDER BY clause, natch.
- create a batch command file with one line for each table and view. This command is a pg_dump of the schema, which is appended to an output file

I also output function definitions, as well as the actual data (not just the schema) of some tables that basically have static or lookup data.

There's a little more to it to suit my particular needs, but the general approach works well. Oh, one other thing I sometimes need to do is to delete lines with db owner if the two db's have different owners.

-Roger

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Rick Gigger
Sent: Thursday, February 09, 2006 11:09 PM
To: Philippe Ferreira
Cc: Nicholas Walker; pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Database Comparison tool?

Is the ordering guaranteed to be the same on both boxes if you do this?

Rick

On Feb 9, 2006, at 1:03 PM, Philippe Ferreira wrote:

>
>> Are there any tools that can compare a database schema, and
>> produce sql of the changes from one version to the next.
>>
>> We have a development server, and it would be great to be able to
>> just run a tool, where we could produce the changes, review it,
>> and then commit to production.
>
> Hi,
>
> Do a "pgdump" of both databases, and use the "diff" tool to compare
> the two generated files !
>
> (But I hope your databases are not too big...)
>
> Philippe Ferreira.
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GUNDUZ 2006-02-10 07:57:13 Re: Database Comparison tool?
Previous Message Rick Gigger 2006-02-10 07:08:40 Re: Database Comparison tool?