Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id E57F0B5DEAF for ; Mon, 30 May 2011 17:16:57 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 28517-01 for ; Mon, 30 May 2011 20:16:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pv0-f174.google.com (mail-pv0-f174.google.com [74.125.83.174]) by mail.postgresql.org (Postfix) with ESMTP id 6B58EB5DD4D for ; Mon, 30 May 2011 17:16:44 -0300 (ADT) Received: by pvg12 with SMTP id 12so1730010pvg.19 for ; Mon, 30 May 2011 13:16:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=vlK3sCTgv/+lFBvSV6QKiYA3N1QFYcZl3SCnqUK1ii8=; b=fNmY2x9y/XlqQZRH9syLYabhk0H11EQclymB3NwRjVMov5BWvNm0ZDLPKagV4YA4n5 J1AI/FIShIK+pb0TrYGahORMoc5CXWRP0brRhHsCsJAuIp72Ef8pfaxUizMZHW6BS/7g uugXXSsBMErlu5rl+GjA64vhpmn8ue2lkZalQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=GjYG/i0qFUl0B9LTvYO0odoia/3+pL/GmIi/0pxBHur6BSAD0APHCkPJ07fE6ydSBZ 3EzQuqyvTB4KiMQHYTQjlFCd9l1HNBgTnbMLpvasPZM1a8VQKiEeNFlNehslM7tnipmP KJgdJhERE5bwU/9zhh5IdKjEmCJiemtb4oyKg= Received: by 10.142.231.14 with SMTP id d14mr780354wfh.106.1306766738477; Mon, 30 May 2011 07:45:38 -0700 (PDT) Received: from [192.168.0.3] (rsargent.dsl.xmission.com [199.104.125.126]) by mx.google.com with ESMTPS id o16sm3141574wff.1.2011.05.30.07.45.35 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 May 2011 07:45:36 -0700 (PDT) Message-ID: <4DE3AD86.5020206@gmail.com> Date: Mon, 30 May 2011 08:45:26 -0600 From: Rob Sargent User-Agent: Thunderbird 2.0.0.24 (X11/20101027) MIME-Version: 1.0 To: Surfing CC: pgsql-sql@postgresql.org Subject: Re: Function to total reset a schema References: <4DE1F7DC.3080700@gmail.com> In-Reply-To: <4DE1F7DC.3080700@gmail.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.898 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201105/178 X-Sequence-Number: 35462 I would hope you have readily at hand the ddl for the schema in question. Then it's simply a matter of drop schema 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 > >