Re: "mirroring" a table - PostgreSQL 7.3.2

Поиск
Список
Период
Сортировка
От Reece Hart
Тема Re: "mirroring" a table - PostgreSQL 7.3.2
Дата
Msg-id 1075139866.4062.43.camel@tallac
обсуждение исходный текст
Ответ на Re: "mirroring" a table - PostgreSQL 7.3.2  ("C. Bensend" <benny@bennyvision.com>)
Список 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 по дате отправления:

Предыдущее
От: "scott.marlowe"
Дата:
Сообщение: Re: popstgresql query
Следующее
От: Randolf Richardson
Дата:
Сообщение: Re: I want to quit