Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 5219F2E006C for ; Wed, 20 Feb 2008 12:05:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 08347-01-3 for ; Wed, 20 Feb 2008 12:05:17 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 910FE2E00BC for ; Wed, 20 Feb 2008 12:04:50 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m1KG4j7F008536; Wed, 20 Feb 2008 11:04:45 -0500 (EST) To: Gregory Stark cc: "Heikki Linnakangas" , "Juho Saarikko" , pgsql-bugs@postgresql.org Subject: Re: BUG #3965: UNIQUE constraint fails on long column values In-reply-to: <87tzk3x2uk.fsf@oxford.xeocode.com> References: <200802181130.m1IBUNdu060026@wwwmaster.postgresql.org> <47BBEADA.4090308@enterprisedb.com> <877ih0x9kk.fsf@oxford.xeocode.com> <47BC0E41.3040704@enterprisedb.com> <87tzk3x2uk.fsf@oxford.xeocode.com> Comments: In-reply-to Gregory Stark message dated "Wed, 20 Feb 2008 11:51:47 +0000" Date: Wed, 20 Feb 2008 11:04:45 -0500 Message-ID: <8535.1203523485@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/185 X-Sequence-Number: 19752 Gregory Stark writes: > "Heikki Linnakangas" writes: >> Return type of hash* functions is just 32 bits. I wonder if that's wide enough >> to avoid accidental collisions? Depends on the application of course... > Oh, I missed that you were suggesting a UNIQUE index. That seems unsafe to me > even for md5 or its ilk. But that would depend on the application too. md5 is designed to be a signature, remember? If there weren't a very high probability of its output being different for different inputs, it wouldn't be good for anything. The built-in hash functions definitely cannot be relied on to not have collisions, though. regards, tom lane