From: | Reece Hart <reece(at)in-machina(dot)com> |
---|---|
To: | "C(dot) Bensend" <benny(at)bennyvision(dot)com> |
Cc: | pgsql-admin <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: "mirroring" a table - PostgreSQL 7.3.2 |
Date: | 2004-01-26 17:57:46 |
Message-ID: | 1075139866.4062.43.camel@tallac |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Randolf Richardson | 2004-01-26 17:58:24 | Re: I want to quit |
Previous Message | scott.marlowe | 2004-01-26 17:39:46 | Re: popstgresql query |