If you want all your rows added in the same COPY command to have the same job_id value, you can copy the data to the staging table, then add the job_id column to this table, and then paste all the data from the staging table into the final table like:
CREATE TABLE destination_staging (LIKE destination); ALTER TABLE destination_staging DROP COLUMN job_id; COPY destination_staging FROM 's3://data/destination/(...)' (...) ALTER TABLE destination_staging ADD COLUM job_id INT DEFAULT 42; INSERT INTO destination SELECT * FROM destination_staging ORDER BY sortkey_column; DROP TABLE destination_staging; ANALYZE TABLE destination; VACUUM destination;
ANALYZE and VACUUM are not needed, but it is highly recommended to update the query analyzer and put all the new data in the correct positions.
source share