| От | Adrian Holovaty |
|---|---|
| Тема | changing records in inherited tables |
| Дата | |
| Msg-id | 200308181037.15244.postgres@holovaty.com обсуждение исходный текст |
| Список | pgsql-novice |
Hi everybody,
I just started using Postgres a few days ago and love it so far. I've been
trying to wrap my head around its OO features, and I have a question about
table inheritance:
Is it possible to change a record in a parent table in such a way that it is
retroactively inserted into a child table? Here's an example:
CREATE TABLE people (
id SERIAL,
first_name VARCHAR(20),
last_name VARCHAR(30)
);
CREATE TABLE athletes (
sport VARCHAR(10),
uniform_no MEDIUMINT
) INHERITS people;
INSERT INTO people (first_name, last_name) VALUES ('John', 'Smith');
What if John Smith later becomes an athlete? Is that best handled by deleting
him from people and reinserting him into athletes while somehow maintaining
the record ID, or is there a better way to do it?
Thanks in advance,
Adrian
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера