gis.stackexchange.com/questions/8409/postgis-feature-compare-function
-- return the id and geometry from the updated table if the attributes -- or -- geometry have changed or it's a new feature. select t2.id, t2.geom from t1, t2 where ( t1.id = t2.id and row(t1.att1, t1.att2, t1.geom) != row(t2.att1, t2.att2, t2.geom)) or t2.id not in (select id from t1)