changing records in inherited tables - Mailing list pgsql-novice

From Adrian Holovaty
Subject changing records in inherited tables
Date
Msg-id 200308181037.15244.postgres@holovaty.com
Whole thread Raw
List 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 by date:

Previous
From: Devrim GUNDUZ
Date:
Subject: Re: Array Data Type
Next
From: Jason Hihn
Date:
Subject: Re: Array Data Type