I have many rows of data to be inserted into a table. Table already has data in it. When I do a bulk insert like this,
INSERT INTO permission(username, permission) values(('john','ticket_view'), ('john','ticket_modify'), ('john','ticket_approve'));
But my table already has a row john, ticket_view
In that case my above insert query ends in an error duplicate key value violates unique constraint
.
How can I ignore this duplicate issue in postgresql 9.3? I just want to insert all the rows. If a similar row exists I want to ignore it. How can I do that? I welcome your help.