Q:

Wipe out value from table

IntegrityError: insert or update on table "procurement_order" violates foreign key constraint "procurement_order_sale_line_id_fkey"
DETAIL:  Key (sale_line_id)=(71) is not present in table "sale_order_line".

I have this error and I know that if I will wipe the value in procurement_order table then the problem will be solved.
So the question is how can I do this using PostgreSQL because I'm not really used it before.

A:

No problem, just make sure you back up the database first, in case something goes wrong.
The following command will wipe all data from table procurement_order:
TRUNCATE TABLE procurement_order;

If this gives you an error, it means that wiping the table violates one or more foreign key constraints. In this case, run the following command -- but understand that it will also wipe the contents of referencing tables:
TRUNCATE TABLE procurement_order CASCADE;

Good luck!

