pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: Surfing <onlinesurfing@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Function to total reset a schema
Date: Mon, 30 May 2011 08:45:26 -0600
Message-ID: <4DE3AD86.5020206@gmail.com> (raw)
In-Reply-To: <4DE1F7DC.3080700@gmail.com>
References: <4DE1F7DC.3080700@gmail.com>

I would hope you have readily at hand the ddl for the schema in 
question.  Then it's simply a matter of drop schema <name> cascade and 
re-run you ddl scripts.

Surfing wrote:
> Hi all,
> I need to write a function that totally empty a schema.
>
> So I have written a TRUNCATE statement for each table and set to 0 
> each sequence.
> Btw, it could be good to execute a vacuum statement on each table, but 
> from within the function this is not allowed.
>
> Is there a way to obtain the same result in another way (without using 
> the vacuum)?
>
> Thanks
>
>



view thread (6+ messages)

Message-ID: <4DE3AD86.5020206@gmail.com>
Permalink:  ../4DE3AD86.5020206@gmail.com/
Also on:    postgresql.org/message-id/4DE3AD86.5020206@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: robjsargent@gmail.com, onlinesurfing@gmail.com
  Subject: Re: Function to total reset a schema
  In-Reply-To: <4DE3AD86.5020206@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox