简体   繁体   中英

Cant add data to my database PSQL, column “column_name” of relation “table_name” does not exist

I'm trying to add some Dummy Data to my database using the following code:

insert into consignment(consignment_id, consignment_type, consignment_received_date, consignment_sell_by_date, consignment_commission, album_id, client_id) 
values ('1','Album','2019-02-11','2019-07-11','10%','2','4');

insert into consignment(consignment_id, consignment_type, consignment_received_date, consignment_sell_by_date, consignment_commission, album_id, client_id) 
values('2','Album','2018-11-21','2019-04-21','10%','','4','2');

insert into consignment(consignment_id, consignment_type, consignment_received_date, consignment_sell_by_date, consignment_commission, album_id, client_id) 
values('3','Album','2019-02-12','2019-03-12','25%','3','3');

The first line goes in fine, then the subsequent two give the Error:

column "consignment_received_date" of relation "consignment" does not exist.

Your first insert statement contains 7 columns and subsequent 7 values. But your second statement contains same number of columns but 8 values instead of 7 but technically it should match with the number of columns. Probably you executed the statements together, since there was a error in second statement it stopped executing the rest statements. Therefore even though your third statement was correct but it was skipped because of the error encountered.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM