In a single query, I need to perform Insert and update on the insertion row. For example, I have a set of columns and its value to be inserted after getting the primary key, I need to update another column on the same row.I tried below query it does not work. Please help
With tempvar as ( INSERT INTO table_name(col1, col2, col3) VALUES ('colval1','colval2','colval3') RETURNING primarykeyid )update table_name set column_to_be_updated = concat('value', 'value') where primarykeyid = (select * from tempvar)