Re: A compare and/or sync. database structure?

From: "durumdara(at)gmail(dot)com" <durumdara(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: A compare and/or sync. database structure?
Date: 2009-08-06 10:09:25
Message-ID: op.ux8jtztlu4w1d6@subdeveloper.chello.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

Thanks...

Sorry, but this is not good solution for me, because of the webserver is
not opened (port) to the net, and I must compare local, a web dbs.

So I try to find a solution, that can create a "map" from structure in
XML, text, etc., and I can get it with ftp and compare it...

First I search for a simple tool that can compare dbs in textual way...

dd

On Wed, 05 Aug 2009 10:49:53 +0200, Guillaume Lelarge
<guillaume(at)lelarge(dot)info> wrote:

> Le mercredi 5 août 2009 à 10:13:44, durumdara(at)gmail(dot)com a écrit :
>> [...]
>> So please help me with your experience: what is the best solution, what
>> is
>> the possible problem that make mistakes with this plan, and how to
>> realize
>> it easily?
>>
>
> You can try check_postgres.pl Perl script. The same_schema action seems
> to be
> what you need.
>
> Here is a little example:
>
> guillaume(at)laptop:~$ createdb db1
> guillaume(at)laptop:~$ psql -c "CREATE TABLE t1(id integer);" db1
> CREATE TABLE
> guillaume(at)laptop:~$ psql -c "CREATE TABLE t2(id integer, c text);" db1
> CREATE TABLE
> guillaume(at)laptop:~$ createdb db2
> guillaume(at)laptop:~$ psql -c "CREATE TABLE t1(id integer);" db2
> CREATE TABLE
>
> So, db1 with two tables and db2 with one only.
>
> guillaume(at)laptop:~$ LANG=C check_postgres.pl --action same_schema
> --dbname db1
> --dbname2 db2
> POSTGRES_SAME_SCHEMA CRITICAL: DB "db1 => db2" Databases were different.
> Items
> not matched: 1 | time=0.01 Table in 1 but not 2: public.t2
>
> It works. Now I add the missing table:
>
> guillaume(at)laptop:~$ psql -c "CREATE TABLE t2(id integer, c text);" db2
> CREATE TABLE
> guillaume(at)laptop:~$ LANG=C check_postgres.pl --action same_schema
> --dbname db1
> --dbname2 db2
> POSTGRES_SAME_SCHEMA OK: DB "db1 => db2" Both databases have identical
> items |
> time=0.01
>
> Works too. Works great actually :)
>
> It works also with the other objects of the database.
>
> Regards.
>
>

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Abraham, Danny 2009-08-06 10:14:03 Re: InitDB 8.3.7 fails on Windows - Failed system call was MapViewOfFileEx
Previous Message Abraham, Danny 2009-08-06 10:00:42 PG fails on Windows Server 2008: could not reattach to shared memory ... : 487