Re: "mirroring" a table - PostgreSQL 7.3.2 - Mailing list pgsql-admin

From Reece Hart
Subject Re: "mirroring" a table - PostgreSQL 7.3.2
Date
Msg-id 1075139866.4062.43.camel@tallac
Whole thread Raw
In response to Re: "mirroring" a table - PostgreSQL 7.3.2  ("C. Bensend" <benny@bennyvision.com>)
List pgsql-admin
On Sat, 2004-01-24 at 20:14, C. Bensend wrote:
I am loath to ask for a hand-hold here, but could you explain a little
more about how to do such a thing?

It's probably easier than you think. Briefly, it goes like this:
1) read http://www.postgresql.org/docs/current/static/tutorial-inheritance.html
2) try those examples
3) In your case:
create table bob_def (surname text);
create table bob () inherits (bob_def);
create table bob_test () inherits (bob_def);

insert into bob (surname) values ('smith');
insert into bob_test (surname) values ('gazpacho');

\d bob
\d bob_test
alter table bob_def add column age integer;
\d bob
\d bob_test

update bob set age=104 where surname='smith';

select * from bob;

Note:
You'll need to index the subtables separately if that's important to you.


-Reece

-- 
Reece Hart, http://www.in-machina.com/~reece/, GPG:0x25EC91A0 0xD178AAF9

pgsql-admin by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: popstgresql query
Next
From: Randolf Richardson
Date:
Subject: Re: I want to quit