By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table one (id int generated always as identity, val varchar(10))
create table two (id int, ts timestamp)
select id, current_timestamp from final table (
insert into one (val) values ('foo'), ('bar'))
ID | 2 |
---|---|
1 | 2024-10-29 20:28:41.719459 |
2 | 2024-10-29 20:28:41.719459 |
with a (id) as (
select id from final table (
insert into one (val) values ('foo'), ('bar'))
)
select id from final table (
insert into two (id, ts)
select id, current timestamp from a)
ID |
---|
3 |
4 |