Several of my tables have fields with default values, including this one:
CREATE TABLE IF NOT EXISTS checks (
shipmentid INT NOT NULL,
status VARCHAR(10) DEFAULT 'COUNTED' NOT NULL,
date DATE NOT NULL,
time TIME NOT NULL,
employeeid INT NOT NULL,
CONSTRAINT pk_checks PRIMARY KEY (shipmentid, status), -- added status to the pkey, removed employeeid
CONSTRAINT fk_checks_shipment FOREIGN KEY (shipmentid)
REFERENCES shipment(id),
CONSTRAINT fk_checks_employee FOREIGN KEY (employeeid)
REFERENCES employee(id)
);
In pgAdmin, if I use a CSV file to import mock data, I can simply uncheck the box for "status" in the Columns tab and the value of "status" for every row is 'COUNTED'. How do I do the same on the command line in PSQL? I frequently wipe the table data and reimport it to start fresh to test different things and I'd like to be able to do it with all the COPY commands in a .sql file and do something like:
\i C:/table_data.sql
Thank you in advance for any help.