Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y8lEZ-0004Tu-GE for pgsql-bugs@arkaria.postgresql.org; Wed, 07 Jan 2015 07:40:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y8lEY-0002S0-H3 for pgsql-bugs@arkaria.postgresql.org; Wed, 07 Jan 2015 07:40:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y8lEX-0002Rt-Cb for pgsql-bugs@postgresql.org; Wed, 07 Jan 2015 07:40:49 +0000 Received: from mail-pd0-x230.google.com ([2607:f8b0:400e:c02::230]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Y8lET-0005Cx-4S for pgsql-bugs@postgresql.org; Wed, 07 Jan 2015 07:40:47 +0000 Received: by mail-pd0-f176.google.com with SMTP id r10so3045867pdi.7 for ; Tue, 06 Jan 2015 23:40:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=Xt8pvhSqs/4Gzxd3WaDQaMbpNVLEktykEZZKnlSAnn8=; b=e4l8IW3Fpz89W/u76e2MCTzYBs9raeLt/GIShK3ATqPo1cU1Wthx2Fzws7Idd36aHj MmmRPI78TH7u7/9VlI7cSsmJw0CVtfE8D7SjQQF0dGa1NGvUeI/13qUYLu5BxViCd9D2 zpczA0NnS2Ra681cnLUp0t2DrObmDiOYVGnmU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=Xt8pvhSqs/4Gzxd3WaDQaMbpNVLEktykEZZKnlSAnn8=; b=bJG/7UzecurO6Hk7em9CyKY+OSeyEZHvEoC3A+F2jiCo7mtW2iS9Xh5Tp7UTu/DNSL pnl1YiUqgYtyXgpJAPhQES0u3H+n/sSIvCT7gIixc0GB6/sti6VCFi2mP6XifW19L7Zq rbIkz9L4XjYx6ImhycJW58Y5S22trqYuAGbvmlr5Z8RWL1wpW7CocenmnAVQ87e3SCyM HWInCgiZdG7Z3Ui1+yaYuJx2eNq0L/4WnR6XQ3mNMEWvmGy+LwTkf0Z4RIHCNukWmQTC zH9FMguUEWEZtKP0XchjtpRU5NA8tmLX/CBkpWOM6WQjA1WUSCISwtNPSXyOlxzee+09 4Iow== X-Gm-Message-State: ALoCoQmBcQuJkEcnVNXT5858MQI2QTtqoyzWXAYbos61efqWToBb9Gq+imKq0NbbcDx3+BJiMX0l X-Received: by 10.70.118.202 with SMTP id ko10mr2965951pdb.48.1420616441135; Tue, 06 Jan 2015 23:40:41 -0800 (PST) Received: from tornado.leadboat.com (c-50-131-89-155.hsd1.ca.comcast.net. [50.131.89.155]) by mx.google.com with ESMTPSA id r1sm892300pdp.83.2015.01.06.23.40.39 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 06 Jan 2015 23:40:40 -0800 (PST) Date: Wed, 7 Jan 2015 02:40:37 -0500 From: Noah Misch To: Tom Lane Cc: Heikki Linnakangas , support@maerix.com, pgsql-bugs@postgresql.org Subject: Re: BUG #11617: issue with dump/restore involving view with hstore data type embedded in where condition Message-ID: <20150107074037.GA2375451@tornado.leadboat.com> References: <20141009200031.25464.53769@wrigleys.postgresql.org> <544ACDAB.7060904@vmware.com> <11046.1414190207@sss.pgh.pa.us> <22372.1414286907@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <22372.1414286907@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On Sat, Oct 25, 2014 at 09:28:27PM -0400, Tom Lane wrote: > I wrote: > > I wonder whether we couldn't fix this better by insisting that these > > operations depend on default btree opclasses instead of looking up > > "=" by name. Upthread I whined that this wouldn't work for comparisons > > of nonidentical datatypes, but could we insist for cross-type cases that > > both types have default btree opclasses belonging to the same opfamily? > > I thought a bit more about this, and that idea isn't going to work, at > least not by itself. Right now you can do, eg, "integer IS DISTINCT > FROM numeric", and it works, but the way it works is that the integer > is promoted to numeric and we use the "numeric = numeric" operator. > int and numeric do not have an opfamily in common, so this case would > fail with the rule above. Is there something precluding implementation of an all-numeric-types opfamily that contains the existing default btree opclass operators? That wouldn't solve every example like this, but it would help here among other places. > A reasonable way to handle that sort of case is to do select_common_type > (ie, UNION-like type promotion) and then insist that the common type have > a default btree opclass. > > However, the common-opfamily approach seems like a better idea when it > works, since it would avoid a runtime type coercion in cases where there > is a suitable cross-type comparison operator. So what I now suggest is: > > 1. If the two inputs are of types that have default btree opclasses in > the same opfamily, and that opfamily has an equality operator that > accepts these input types, use that operator. > > 2. Otherwise, do select_common_type(), and see if the common type has > a default btree opclass. If so, use that opclass's equality operator > after coercing both inputs to the common type. > > 3. If neither of those work, fail. I'm loathe to introduce another operator selection method. We have the func_select_candidates() method and the opfamily method. This third method shares some features with each of the existing two, and it makes novel use of select_common_type(). To break compatibility like this, we had better be confident that the new algorithm is a great one. I'm confident that the current specification is a bad one, but I'm not confident that bringing select_common_type() into the mix is the right replacement. On Fri, Oct 24, 2014 at 06:36:47PM -0400, Tom Lane wrote: > Heikki Linnakangas writes: > > I don't think this can be solved without some additional syntax, for > > specifying the equality operator explicitly. I propose that we add an > > optional USING after the problematic expressions: > > > a IS DISTINCT FROM b USING myschema.= > > NULLIF(a, b) USING myschema.= > > ... > > Meh. When would this be used? I don't think we'd want ruleutils to > deparse this way all the time. Also, in the case of IS DISTINCT FROM > on composite values, it's not clear that one operator name is enough. The similar situation with IN -> =ANY is tolerable, and I could be content with ruleutils deparsing that way every time. That's certainly the safe fix. Thanks, nm -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs