I have a Postgres table publications that has a boolean column active, and my task was to set all the active values to FALSE, so I did the following copy command to have a backup of the rows that have an active value of TRUE:
\copy (SELECT publication_id FROM publications WHERE active = TRUE)
to '~/active_publications.csv'
with csv
In the end, I got a CSV file that has all the publication_ids of the active rows. Then I ran the following command to set all the active values to FALSE:
UPDATE publications SET active = FALSE;
Now I need to go back in a reverse process: How can I use this file to set the active values back to TRUE for all the rows that have a publication_id in this CSV file?