I need to select some rows from a table based on a certain field, something like
select * from table where ts=100
On these rows, I need to edit the value in ts to current value (100 in the above example) and increase it by a constant amount (say 50 so that new value is ts=150 for all these rows)
While retaining the old rows in the table, these new rows also need to be inserted into the table.
e.g. If the table was
ts A B C
100 x y z
90 a d f
30 s y z
100 c v b
Then new table would be
ts A B C
100 x y z
90 a d f
30 s y z
100 c v b
150 x y z
150 c v b
Using PostgreSQL