I use Django and it requires id column in each table if you don't want to have a headache. Unfortunately, I was careless and my table bp.geo_location_vague didn't contain this field. I initialed little trick. Step 1:
CREATE VIEW bp.geo_location_vague_vw AS
SELECT
a.id, -- I change order of id column here.
a.in_date,
etc
FROM bp.geo_location_vague a
Step 2: (without create table - table will create automaticaly!)
SELECT * into bp.geo_location_vague_cp2 FROM bp.geo_location_vague_vw
Step 3:
CREATE SEQUENCE bp.tbl_tbl_id_seq;
ALTER TABLE bp.geo_location_vague_cp2 ALTER COLUMN id SET DEFAULT nextval('tbl_tbl_id_seq');
ALTER SEQUENCE bp.tbl_tbl_id_seq OWNED BY bp.geo_location_vague_cp2.id;
SELECT setval('tbl_tbl_id_seq', COALESCE(max(id), 0)) FROM bp.geo_location_vague_cp2;
Because I need have bigserial pseudotype in the table. After SELECT * into pg will create bigint type insetad bigserial.
step 4: Now we can drop the view, drop source table and rename the new table in the old name. The trick was ended successfully.