Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id CF71B2E00E3 for ; Sun, 9 Mar 2008 12:27:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 19689-07 for ; Sun, 9 Mar 2008 12:27:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.157]) by postgresql.org (Postfix) with ESMTP id 3B2F82E00DC for ; Sun, 9 Mar 2008 12:27:09 -0300 (ADT) Received: by fg-out-1718.google.com with SMTP id 22so1187610fge.23 for ; Sun, 09 Mar 2008 08:27:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=rve1irlL0lU+clTD5c1VHG0QvF3n8CSoDFUuH0BcI2o=; b=xzuiXZk93GLqtjU/RoVkyhqDzqVeNg3lE07N7TsGRNX1GeSaUcUtiwD6tLhULQ2VnEe3/Xh6ylmEPgxABRl8pRdgjvALfPpQA5igNcYUOjxYPSJcd97odlBwgrH6BucgWfCsA1J48KtixB1gfayVtPHjLLI12Dfqaq/fEzDWX/Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DESfDyhxq0P64pIdRFw07/eMI57qNZspWu2+LZ6c+rtmiqWNktV5j3N+0Dq1SxezgRW8E6UYKUvYRIi3TTvG4e34V9YRZyMzaP/aROx8nZRcimd4PHuhyLVDNBvuvDDpz55gupvomSLauBZMvISG5zg9uTnpWMWaiN/gbraV0kM= Received: by 10.86.59.2 with SMTP id h2mr4943910fga.63.1205076428990; Sun, 09 Mar 2008 08:27:08 -0700 (PDT) Received: by 10.86.4.15 with HTTP; Sun, 9 Mar 2008 08:27:08 -0700 (PDT) Message-ID: Date: Sun, 9 Mar 2008 15:27:08 +0000 From: "Jamie Tufnell" To: pgsql-sql@postgresql.org Subject: Re: Composite UNIQUE across two tables? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <47D100E0.A3DD.0030.0@indicator.be> <20080307083421.26A9D700009D@mwinf2f21.orange.fr> <47D110C0.A3DD.0030.0@indicator.be> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200803/48 X-Sequence-Number: 30376 On 3/7/08, Jamie Tufnell wrote: > On 3/7/08, Bart Degryse wrote: > > I haven't tested these two statements, but I'm using exactly this > > concept on some tables myself. > > My equivalent of your users table contains some 3,000,000 records. > > My equivalent of your sites table contains some 150,000 records. > > And it works fine... > When I try to create the index I get the following error: > > ERROR: functions in index expression must be marked IMMUTABLE > > Out of curiosity, I declared it IMMUTABLE and it worked for the > purposes of my small, isolated test,. > > Am I opening myself up to problems by doing this? Does anyone have any comment on this? I've done some more testing and have yet to run into a problem. I'd be really interested to hear some opinions on this. Cheers, J.