How can I compare sql create script with running database?

Started by Bjørn T Johansenalmost 18 years ago5 messagesgeneral
Jump to latest
#1Bjørn T Johansen
btj@havleik.no

If I already have a running database, how can I compare the tables in the database with the sql script to discover the differences?

Regards,

BTJ

--
-----------------------------------------------------------------------------------------------
Bjørn T Johansen

btj@havleik.no
-----------------------------------------------------------------------------------------------
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"
-----------------------------------------------------------------------------------------------

In reply to: Bjørn T Johansen (#1)
Re: How can I compare sql create script with running database?

On 05/06/2008 10:52, Bjørn T Johansen wrote:

If I already have a running database, how can I compare the tables in
the database with the sql script to discover the differences?

You can use pg_dump with the -s option to dump the schema of the
database, and run it through the diff tool of your choice.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

#3Bjørn T Johansen
btj@havleik.no
In reply to: Raymond O'Donnell (#2)
Re: How can I compare sql create script with running database?

On Thu, 05 Jun 2008 11:06:36 +0100
Raymond O'Donnell <rod@iol.ie> wrote:

On 05/06/2008 10:52, Bjørn T Johansen wrote:

If I already have a running database, how can I compare the tables in
the database with the sql script to discover the differences?

You can use pg_dump with the -s option to dump the schema of the
database, and run it through the diff tool of your choice.

Ray.

Well, not really an option because I don't think the dump will be an exact match to the sql script....

BTJ

#4Tino Wildenhain
tino@wildenhain.de
In reply to: Bjørn T Johansen (#3)
Re: How can I compare sql create script with running database?

Hi,

Bjørn T Johansen wrote:

On Thu, 05 Jun 2008 11:06:36 +0100
Raymond O'Donnell <rod@iol.ie> wrote:

On 05/06/2008 10:52, Bjørn T Johansen wrote:

If I already have a running database, how can I compare the tables in
the database with the sql script to discover the differences?

You can use pg_dump with the -s option to dump the schema of the
database, and run it through the diff tool of your choice.

Ray.

Well, not really an option because I don't think the dump will be an exact match to the sql script....

Unless you create all your objects with your script into a different
Database on the server then use pg_dump -s on both and compare the
result :-)

Cheers
Tino

#5Bjørn T Johansen
btj@havleik.no
In reply to: Tino Wildenhain (#4)
Re: How can I compare sql create script with running database?

On Thu, 05 Jun 2008 15:28:55 +0200
Tino Wildenhain <tino@wildenhain.de> wrote:

Hi,

Bjørn T Johansen wrote:

On Thu, 05 Jun 2008 11:06:36 +0100
Raymond O'Donnell <rod@iol.ie> wrote:

On 05/06/2008 10:52, Bjørn T Johansen wrote:

If I already have a running database, how can I compare the tables in
the database with the sql script to discover the differences?

You can use pg_dump with the -s option to dump the schema of the
database, and run it through the diff tool of your choice.

Ray.

Well, not really an option because I don't think the dump will be an exact match to the sql script....

Unless you create all your objects with your script into a different
Database on the server then use pg_dump -s on both and compare the
result :-)

Cheers
Tino

That I could do.... :)

BTJ