X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 69D17D1B4A4 for ; Sun, 25 Jan 2004 04:15:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 98791-09 for ; Sun, 25 Jan 2004 00:14:42 -0400 (AST) Received: from fusion.bennyvision.com (fusion.bennyvision.com [216.161.119.28]) by svr1.postgresql.org (Postfix) with SMTP id AE994D1B456 for ; Sun, 25 Jan 2004 00:14:41 -0400 (AST) Received: (qmail 2086 invoked from network); 25 Jan 2004 04:14:40 -0000 Received: from localhost (HELO webmail.stinkweasel.net) (127.0.0.1) by fusion.bennyvision.com with SMTP; 25 Jan 2004 04:14:40 -0000 Received: from 63.227.74.41 (SquirrelMail authenticated user benny) by webmail.stinkweasel.net with HTTP; Sat, 24 Jan 2004 22:14:18 -0600 (CST) Message-ID: <53768.63.227.74.41.1075004080.squirrel@webmail.stinkweasel.net> In-Reply-To: <1074984488.5591.29.camel@whoville> References: <53076.63.227.74.41.1074972926.squirrel@webmail.stinkweasel.net> <5233.1074978599@sss.pgh.pa.us> <56251.63.227.74.41.1074979320.squirrel@webmail.stinkweasel.net> <1074984488.5591.29.camel@whoville> Date: Sat, 24 Jan 2004 22:14:18 -0600 (CST) Subject: Re: "mirroring" a table - PostgreSQL 7.3.2 From: "C. Bensend" To: pgsql-admin@postgresql.org User-Agent: SquirrelMail/1.4.2 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/195 X-Sequence-Number: 12058 > when you drop a column). This is NOT "on the same level as a quick > DROP/CREATE". Hi Reece, My apologies to Tom - I certainly was not trying to disreguard or "blow off" his advice. I think my lack of understanding may have manifested itself as dismissal. I'm a systems/network guy, not a DBA by any stretch of the word, and most of this is a real learning experience for me. :/ > Here's a proposal to get what you want: Create a super table bob_def and > two sub tables bob and bob_test. Changes to the definition of bob_def > (e.g., alter table add column...) will get immediately reflected in both > children. You'll insert data into bob and bob_test; bob_def contains no > rows. Selects on bob and bob_test are independent. In short, the > definitions will always be consistent and the data will be completely > independent. You could periodically truncate bob_test and insert ... > select to mirror the data too. > > A lesser option is to have bob_test inherit from bob, then use rules to > enforce the ONLY keyword for select/insert/update on bob. The > implementation of this option is less clear to me and there are a few > likely gotchas. I am loath to ask for a hand-hold here, but could you explain a little more about how to do such a thing? >> CREATE TABLE test_bob AS ( SELECT * FROM bob WHERE '1' = '2' ); > > > I don't understand why this does what you want... it requires explicit > intervention (meaning not "real time") to mirror the table definition. This is just an example of what I need to do - just duplicate the table structure exactly, and never mind the data. I know it isn't the solution. I just wanted folks to understand what I'd like to do. :) Thanks much for your help, Reece, it is greatly appreciated. :) Benny -- "Have you ever tried simply turning off the TV, sitting down with your children, and hitting them?" -- Bender, "Futurama"