Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 3A41BB5DBD6 for ; Sun, 29 May 2011 04:38:14 -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 99516-01 for ; Sun, 29 May 2011 07:38:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wy0-f174.google.com (mail-wy0-f174.google.com [74.125.82.174]) by mail.postgresql.org (Postfix) with ESMTP id 83BBCB5DBD5 for ; Sun, 29 May 2011 04:38:06 -0300 (ADT) Received: by wya21 with SMTP id 21so2036495wya.19 for ; Sun, 29 May 2011 00:38:05 -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 :subject:content-type:content-transfer-encoding; bh=YcpqorhlgBU3wySHSHUsIlolvRNdtgPICJgL+NXmbAs=; b=LSKJeii7qLPbDIHKI7Grffi8ogE+6FXWw73K3Z0b1mDu/+bZ9ZyuXcE/awMHjnw8pO 8r6TiQKuk7hyengH00gwD3ogEb8pI8MsajHEMxnHk81VhSjsn70eyQFaZEc2SDiLR9sl d1iswTqW2YanPwrHmUTFXWlWlnJGTLsAn+NPA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=P4VnFkt6MZSUjK2cKvc58t9Y7HeH7Z68q8BY4xwgE5yEKSJNuAfnAqUyglE1TD0ysR q+7iMDUhX2G34jW0+PQ3um3OjO9fy1sHMkLTqVND0JDOnX1xjf0SeGmMKT9yvGMbWpQh abG2YBBtaPPZKZBLmYaYN5cnXRhnMT76sXlXA= Received: by 10.227.183.133 with SMTP id cg5mr3684433wbb.49.1306654685693; Sun, 29 May 2011 00:38:05 -0700 (PDT) Received: from [192.168.1.100] (host228-237-dynamic.211-62-r.retail.telecomitalia.it [62.211.237.228]) by mx.google.com with ESMTPS id o19sm2265195wbh.38.2011.05.29.00.38.04 (version=SSLv3 cipher=OTHER); Sun, 29 May 2011 00:38:05 -0700 (PDT) Message-ID: <4DE1F7DC.3080700@gmail.com> Date: Sun, 29 May 2011 09:38:04 +0200 From: Surfing User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; it; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Function to total reset a schema 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.888 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201105/174 X-Sequence-Number: 35458 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