pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Reece Hart <reece@in-machina.com>
To: C. Bensend <benny@bennyvision.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: "mirroring" a table - PostgreSQL 7.3.2
Date: Mon, 26 Jan 2004 09:57:46 -0800
Message-ID: <1075139866.4062.43.camel@tallac> (raw)
In-Reply-To: <53768.63.227.74.41.1075004080.squirrel@webmail.stinkweasel.net>
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>
	<53768.63.227.74.41.1075004080.squirrel@webmail.stinkweasel.net>

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

view thread (6+ messages)

Message-ID: <1075139866.4062.43.camel@tallac>
Permalink:  ../1075139866.4062.43.camel@tallac/
Also on:    postgresql.org/message-id/1075139866.4062.43.camel@tallac

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: reece@in-machina.com, benny@bennyvision.com
  Subject: Re: "mirroring" a table - PostgreSQL 7.3.2
  In-Reply-To: <1075139866.4062.43.camel@tallac>
  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> <53768.63.227.74.41.1075004080.squirrel@webmail.stinkweasel.net> <1075139866.4062.43.camel@tallac>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox