X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 45D063A3B93 for ; Sun, 24 Oct 2004 21:26:56 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16054-10 for ; Sun, 24 Oct 2004 20:26:20 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 43E8B3A2BE5 for ; Sun, 24 Oct 2004 21:26:46 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id i9OKQsGd017822; Sun, 24 Oct 2004 16:26:54 -0400 (EDT) To: Christian Niles Cc: pgsql-jdbc@postgresql.org Subject: Re: LargeObject API and OIDs In-reply-to: References: Comments: In-reply-to Christian Niles message dated "Sun, 24 Oct 2004 13:34:15 -0400" Date: Sun, 24 Oct 2004 16:26:54 -0400 Message-ID: <17821.1098649614@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/252 X-Sequence-Number: 11357 Christian Niles writes: > However, since a versioning system will have a higher number of entries > compared to a normal storage system, I'm curious if there's any chance > for data corruption in the case that the DB runs out of OIDs. Ideally, > the database would raise an exception, and leave the existing data > untouched. From what I've read in the documentation, OIDs aren't > guaranteed to be unique, and may cycle. In this case, would the first > large object after the limit overwrite the first object? No; instead you'd get a failure during lo_create: /* Check for duplicate (shouldn't happen) */ if (LargeObjectExists(file_oid)) elog(ERROR, "large object %u already exists", file_oid); You could deal with this by retrying lo_create until it succeeds. However, if you are expecting more than a few tens of millions of objects, you probably don't want to go this route because the probability of collision will be too high; you could spend a long time iterating to find a free OID. Something involving a bigint identifier would work better. > Also, would > the number of large objects available be limited by other database > objects that use OIDs? No. Although we use just a single OID sequence generator, each different kind of system object has a separate unique index (or other enforcement mechanism), so it doesn't really matter if, say, an OID in use for a large object is also in use for a table. regards, tom lane