Re: Database schema diff - Mailing list pgsql-hackers

From Michal Novotny
Subject Re: Database schema diff
Date
Msg-id 561E561C.1000503@trustport.com
Whole thread Raw
In response to Re: Database schema diff  (Torello Querci <tquerci@gmail.com>)
List pgsql-hackers
I have to admit I was having the same idea few years ago however I never
got to implement it, nevertheless I should mount 2 trees for diff
comparison, isn't that correct?

I mean to mount <old-dump> as /mnt/dumps/old and <new-dump? as
/mnt/dumps/new and run diff tool from /mnt/dumps on old and new to get
the difference. This, however, requires mounting directly onto a file
system space (the main advantage why to use FUSE) which is what I would
like to avoid.

Nevertheless, if I overlook my unwillingness to mount it, and if we say,
it's fine for me, does it accept the dump file to be mounted or does it
work on the live system directly in the PgSQL database system?

Thanks,
Michal

On 10/14/2015 10:59 AM, Torello Querci wrote:
> Few years ago I developed a tool called fsgateway
> (https://github.com/mk8/fsgateway) that show metadata (table, index,
> sequences, view) as normal files using fuse.
> In this way to yout can get differences between running db instance
> using diff, meld or what do you prefear.
> 
> Unfortunally at the moment not all you need is supported, yet.
> 
> Best regards
> 
> P.S. I think that this is the wrong list for questione like this one.
> 
> On Wed, Oct 14, 2015 at 10:26 AM, Shulgin, Oleksandr
> <oleksandr.shulgin@zalando.de <mailto:oleksandr.shulgin@zalando.de>> wrote:
> 
>     On Tue, Oct 13, 2015 at 5:48 PM, Michal Novotny
>     <michal.novotny@trustport.com <mailto:michal.novotny@trustport.com>>
>     wrote:
> 
>         Hi guys,
> 
>         I would like to ask you whether is there any tool to be able to
>         compare
>         database schemas ideally no matter what the column order is or
>         to dump
>         database table with ascending order of all database columns.
> 
>         For example, if I have table (called table) in schema A and in
>         schema B
>         (the time difference between is 1 week) and I would like to
>         verify the
>         column names/types matches but the order is different, i.e.:
> 
>         Schema A (2015-10-01) |  Schema B (2015-10-07)
>                               |
>         id int                |  id int
>         name varchar(64)      |  name varchar(64)
>         text text             |  description text
>         description text      |  text text
> 
>         Is there any tool to compare and (even in case above) return
>         that both
>         tables match? Something like pgdiff or something?
> 
>         This should work for all schemas, tables, functions, triggers
>         and all
>         the schema components?
> 
> 
>     I've used pg_dump --split for this purpose a number of times (it
>     requires patching pg_dump[1]).
> 
>     The idea is to produce the two database's schema dumps split into
>     individual files per database object, then run diff -r against the
>     schema folders.  This worked really well for my purposes.
> 
>     This will however report difference in columns order, but I'm not
>     really sure why would you like to ignore that.
> 
>     --
>     Alex
> 
>     [1] http://www.postgresql.org/message-id/AANLkTikLHA2x6U=q-t0j0YS78txHFmdtyxJfsrsRcLqN@mail.gmail.com
> 
> 



pgsql-hackers by date:

Previous
From: Amir Rohan
Date:
Subject: Re: Proposal: pg_confcheck - syntactic & semantic validation of postgresql configuration files
Next
From: Michal Novotny
Date:
Subject: Re: Database schema diff