Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGt08-0001k6-Ie for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 21:21:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fGt07-0000Au-ML for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 21:21:23 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGsxI-0003UN-D7 for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 21:18:28 +0000 Received: from 23-25-19-49-static.hfc.comcastbusiness.net ([23.25.19.49] helo=jeeves.wrkhors.com) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fGsxE-0002Ha-Vi for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 21:18:26 +0000 Received: from wrkhors.com (localhost [127.0.0.1]) by jeeves.wrkhors.com (Postfix) with ESMTP id 8E60231C7CC; Thu, 10 May 2018 16:29:24 -0500 (CDT) Date: Thu, 10 May 2018 16:16:48 -0500 From: Steven Lembark To: Tom Lane Cc: lembark@wrkhors.com, pgsql-general@lists.postgresql.org Subject: Re: Selecting strict, immutable text for a composite type. Message-ID: <20180510161648.4e5ea6a0@wrkhors.com> In-Reply-To: <30030.1525977686@sss.pgh.pa.us> References: <20180510103041.472408bb@wrkhors.com> <20099.1525967568@sss.pgh.pa.us> <20180510132910.2fec9600@wrkhors.com> <30030.1525977686@sss.pgh.pa.us> Organization: Workhorse Computing MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, 10 May 2018 14:41:26 -0400 Tom Lane wrote: > [ please keep the list cc'd ] > > Steven Lembark writes: > > On Thu, 10 May 2018 11:52:48 -0400 > > Tom Lane wrote: > >> Maybe you should show a more concrete example of what's not > >> working. > > > The problem is with gists telling me that they cannot index > > the type. This works for enums, just not the composite type. > > Oh, well, they can't. There's no GiST opclass covering arbitrary > composite types. This doesn't seem very surprising to me given > the lack of operators that such an opclass might accelerate. But I thought that they could include functions of composite types that were indexable (e.g., text)? e.g., enums. > What are you expecting an index on such a column to do for you? > If you just want a uniqueness constraint, plain btree can handle it. The composite participates in an exclusion constraint: location lat_lng_t not null , effective tstzrange not null defualt tstzrange( now(), 'infinity', '(]' ) , exclude using gist ( location using =, effective using && ) i.e., the time series can have only one effective set of data for any one period. So far as I knew it was possible to have a function on the type that produced an indexable type (e.g., text). This worked for the enums, I thought it would work for a composite: produce a text value that is indexable. Or is the declaration of the exclusion with a function rather than the column? Or a function rather than '='? Or a separate declaration that describes comparing the composite type that allows the gist to work? -- Steven Lembark 1505 National Ave Workhorse Computing Rockford, IL 61103 lembark@wrkhors.com +1 888 359 3508