postgresql - Multi-INSERT with unchangeable param -


is there way insert multiple values 1 db unchangable? thought without success:

with t (select date_trunc('hour', now()))  insert my_table(id, time) values (1,t),(2,t); 

no need cte, use plain select source insert:

insert my_table (id, time) select i, date_trunc('hour', now()) generate_series(1,2) i; 

if want cte, need select in values clause:

with t (    select date_trunc('hour', now()) hour_t )  insert my_table(id, time)  values  (1, (select hour_t t)), (2, (select hour_t t)); 

Comments