lol, what are you using the oid for? Postgres OID's are not forced unique -- they will wrap (and dup) eventually. If you have a lot of inserts and deletes I am surprised you have not been caught by that already. The post above has the correct solution -- just wanted you to be aware of your design flaw.