drop table if exists prueba cascade; create table prueba (i int, d date); insert into prueba select foo, current_date - ((foo * 2) || ' months')::interval from generate_series(1, 20) foo; begin; alter table prueba rename to prueba_old; create table prueba (i int, d date) partition by range (extract(year from d), extract(month from d)); alter table prueba attach partition prueba_old for values start (unbounded, unbounded) end (2008,1) no validate; commit;