Search Postgresql Archives

Re: restoring a database to its initial state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tom Lane ha scritto:
> Pavel Stehule <pavel.stehule@xxxxxxxxx> writes:
>> 2010/3/13 Manlio Perillo <manlio.perillo@xxxxxxxxx>:
>>> Usually when I need to restore a database to its initial state, what I
>>> do is to simply drop it, and then re-create it.
>>> However on a shared hosting this is not possible.
> 
>> Usually people use a install and a uninstall scripts. First creates
>> dbobjects, second removes objects.
> 
> "pg_dump --clean" can help with creating an uninstall script.
> 

The problem is that it is not possible to *just* having pg_dump generate
the SQL statement for database cleanup.

I was thinking to write a simple Python script for the job.
It will read objects from the pg_catalog, having an associated owner:

 pg_class, pg_conversion, pg_database, pg_language, pg_namespace,
 pg_opclass, pg_operator, pg_opfamily, pg_proc, pg_tablespace,
 pg_ts_config, pg_ts_dict, pg_type

For each object the script will issue an appropriate DROP CASCADE statement.

Is this correct?


Thanks  Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkufoGIACgkQscQJ24LbaUT3EgCghRQy4BdYtaGAXNE0Mx1gj0LT
mdgAoIiRPvgEdUy+STDhfoppgz9MRQVZ
=3uye
-----END PGP SIGNATURE-----

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux