how to insert a date series in postgreSQL

1.8k views Asked by At

I want to insert a Date series into an existing table (public.test) in the column(day) starting from 2015-04-01 ,2015-04-02 ,.....to 2015-04-30.i know there is a generate series method in postgreSQL.But Can I generate dates using that or is there any other method to generate Dates?Any help is appreciated.

1

There are 1 answers

1
Vao Tsun On BEST ANSWER

smth like

insert into public.test ("day") 
select generate_series('2015-04-01'::date,'2015-04-30'::date,'1 day'::interval);

should work