Is it possible to do a single query/insert statement that inserts a number of values - however the type of values might be wrong. If a type would be wrong it should just be "ignored".

IE say I have a table with 3 fields (id, message and amount) with amount being numeric

I would updating using the following:

UPDATE "table"
SET "message"='ERROR', amount='abc'
WHERE "id" = 797723

However this gives the error and thus doesn't update the fields it could (message). Is it possible to make postgres ignore the errors and update "as much as possible"?

There is a very similar question this, however that deals with a quite specific case and as far as I understood is not applicable to this question.

  • 1
    No, not possible. A SQL statement is either valid, or invalid. Not "partially valid"
    – user1822
    Feb 2 at 16:01


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.