X-Git-Url: https://git.8kb.co.uk/?p=postgresql%2Fpg_update_chunks;a=blobdiff_plain;f=pg_chunk_update.plpgsql;h=9c0e4c61bd460529e9ffe58273f469d4c7bdf501;hp=0aeb80caedf29a01f6e07b9da33f4f9f3ded04a3;hb=HEAD;hpb=498f8dbc3b8ae9261bf1406eb28a47ed62d88fc6 diff --git a/pg_chunk_update.plpgsql b/pg_chunk_update.plpgsql index 0aeb80c..9c0e4c6 100755 --- a/pg_chunk_update.plpgsql +++ b/pg_chunk_update.plpgsql @@ -30,6 +30,7 @@ BEGIN PERFORM dblink_connect('chunk_updates', in_conninfo); + -- A lot of this could be switched out for format() in 9.1+ v_sql := 'SELECT count(*)/' || in_chunks || ' FROM ' || quote_ident(in_nspname) || '.' || quote_ident(in_relname) || ' WHERE ((' || in_fields || ') IS NULL OR (' || in_fields || ') <> (' || in_values || '))' || COALESCE(' AND ' || regexp_replace(in_where_clause, E'WHERE\\y','AND', 'i'),'') || ';';