X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 36D56DA5ED for ; Wed, 19 Oct 2005 19:10:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51246-04 for ; Wed, 19 Oct 2005 22:10:44 +0000 (GMT) Received: from ptb-relay04.plus.net (ptb-relay02.plus.net [212.159.14.213]) by svr1.postgresql.org (Postfix) with ESMTP id 5C0B1D9E7C for ; Wed, 19 Oct 2005 19:10:44 -0300 (ADT) Received: from [84.92.184.68] (helo=[192.168.0.2]) by ptb-relay04.plus.net with esmtp (Exim) id 1ESM91-0001S1-1U for pgsql-admin@postgresql.org; Wed, 19 Oct 2005 23:10:47 +0100 Message-ID: <4356C480.7050501@lancaster.ac.uk> Date: Wed, 19 Oct 2005 23:11:12 +0100 From: Chris Jewell User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Migrating tables to schemas Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200510/224 X-Sequence-Number: 19296 Hi, With an ever increasing number of tables being added to our research database, we have come to the conclusion that we need to confine individual users to private schemas instead of everybody creating their tables in the default public schema. In order to move the tables, I have used a CREATE TABLE . AS SELECT * FROM public.; command on each private table. This worked fine. However, when it came to DROPping the old tables from the public schema, I had trouble with user's views that were dependent on these tables. I don't want to use the CASCADE attribute as I don't want to erase all my users' views. Thus, my question is: can I migrate the views such that they point to the new tables in the users' schemata, and/or how do I drop the public schema tables without dropping the users' views? Thanks, Chris -- -- Chris Jewell, BSc(Hons), BVSc, MRCVS Dept of Maths and Statistics Fylde College Lancaster University Lancaster Lancs LA1 4YF