Numbering rows consecutively for a number of tables
If I understand correctly, you want to restart the numbering with 0 for every table.
Use the window function row_number() in an UPDATE:

UPDATE tbl t
SET    xid = n.xid
FROM  (SELECT ctid, row_number() OVER (ORDER BY aid, bid, cid) - 1 AS xid FROM tbl) n
WHERE  t.ctid = n.ctid;


Using ctid as poor man's surrogate for a primary key, since you neglected to disclose your table definition.

SQL Fiddle.
db&lt;>fiddle here