Assume I have two tables, oldstatistics and statistics, the newer table has a different constraint on the time column.
For example the newer table has the following contraint and the old table has data which violates:
CONSTRAINT check_ts_2013_03 CHECK (statistictime >= '2013-03-01 01:00:00+01'::timestamp with time zone AND statistictime < '2013-04-01 02:00:00+02'::timestamp with time zone)
and data that violates let's say they have statistictime '2013-04-01 00:15:00+01'
I found some solution for SQLite with INSERT OR IGNORE (if a constraint violation occurs the rows will be skipped, and it will continue) , but not for POSTGRESQL.
Do you have any suggestions?
DOto run PL/pgSQL in ordinary SQL: postgresql.org/docs/9.4/static/sql-do.html or create a stored function.psqlwithpgsql..., but still you can solve your problem with pgSQL as it supports row by row processing (procedural statements)