Q:

Modifying the schema of a table to make it inherit from another one without recreating the table or reinserting the data

I have several tables in my PostgreSQL database that have a couple of common columns. I thought it would be a good idea if I move those common columns into a new table and made the tables inherit from this new table. For example:
create table foo_bar (
    code varchar(9) primary key,
    name varchar,
    bar integer
);

After refactoring:
create table foo (
    code varchar(9) primary key,
    name varchar
);

create table foo_bar (
    bar integer
) inherits (foo);

The problem is, I have lots of data in foo_bar, as well as many views that refer to this table.
Is it possible to alter definition of foo_bar to achieve the above change without dropping the data in the table?

A:

CREATE TABLE foo (
    code varchar(9),
    name varchar
);

ALTER TABLE foo_bar INHERIT foo;

