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 1fcgAT-0003FH-LC for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Jul 2018 00:06:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fcgAS-0005Ub-10 for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Jul 2018 00:06:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fcgAR-0005UU-Qg for pgsql-hackers@lists.postgresql.org; Tue, 10 Jul 2018 00:06:07 +0000 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fcgAN-0001j5-Th for pgsql-hackers@lists.postgresql.org; Tue, 10 Jul 2018 00:06:07 +0000 Received: by mail-qt0-x243.google.com with SMTP id l10-v6so16952001qtj.0 for ; Mon, 09 Jul 2018 17:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=HdERWZn0RaCkNwaRhgxg6sCpIzyx9TPKkLJCOnBq7U0=; b=bA9UTNIuBrC5TtE4pVqQnVGSHPccR7MX490w2R2UAcuN4IjVWYJqtLaF8C/TbrQJai UisGa5vBw+8VZ/gyIlYKIFdLG4eZKCIORU/9wnxikFLQQy3JCWaHQcllewbB/xsYkjrH r0qq37QBa+gmHqI1oG3Z9v7qp+jEq5pV6fE0gR2bmgojXsnnmFKBiqDTBhzw2DxPtmt1 PFwBpvjKYK8xIXUf0hLpls/ty6ZbLdOHd1ilx5taHELHbQhmnOLTSwvleIPWs+g2hOPX s67Ih5s+wgRHuiqH29DwcAsStH5u/EzbzcDybg2FlDtbgDGC5JynckIphXphHGm/arGw RhqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=HdERWZn0RaCkNwaRhgxg6sCpIzyx9TPKkLJCOnBq7U0=; b=LNoCeL3U8qlzuOZbT3/SuRJ1YSNZZdDRrqMo/6KezhS+gqmBzj1xxQAlbiWxq8+Fk3 fUVxcRlnqGQKykfJsXZwJkBtq7nZRyq3p+nmoqBKoFvKcRBK3sSJ4csZEqSCz1vT71m/ 8V73XVlES2v7VYOWSC4fMFootmYeEx+c7j8e+Zqlc81Dqvjdpm1ITSNVgd0NmvouJVVg GDpqGkEx96WHDf75wbdiwC/PzrkjGBZGXNHf5V8AOUgsXc5FI2CYoRw5g8oaD5oWd06D A4195D9OEWXEapX8bvqNORaMSr0+J/CMjTi9mn4Fd7QUNK6C2cOGYnY3bc0irXatlBWg oDbg== X-Gm-Message-State: APt69E2+foarSnwdXeISlSHmFMMyf16CVF7zS4mTuow1+IyIIE7mYD01 lr6ujGIQAJ+/DyMdZFGa/O5A4/ERmeiY8EqFTtZTAyINrMLf07k8MJnTMspnHsk0CH2zQkbUQjt 0GgjlBtx43ighX9S449wrx8c1So5EICbFgodPREsdJIaZ8KszMWjZ5JC7fwU+SwT5Hj9kMYMQmA uaDp+2QbD218ga3Qall9Nq X-Google-Smtp-Source: AAOMgpdNsHiSTcaaBSlRd3JhxZ2CFomSN0jumwQgqTmiwxXaGxBMZs+CokLHl+fe2bbntmGmN0E0jg== X-Received: by 2002:ac8:d4a:: with SMTP id r10-v6mr20801868qti.271.1531181161657; Mon, 09 Jul 2018 17:06:01 -0700 (PDT) Received: from [192.168.10.146] ([98.122.175.38]) by smtp.gmail.com with ESMTPSA id e33-v6sm1177767qte.54.2018.07.09.17.06.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 17:06:01 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: cannot restore schema with is not distinct from on hstore since PG 9.6.8 To: Tom Lane , Marc Cousin Cc: pgsql-bugs@postgresql.org, pgsql-hackers@lists.postgresql.org References: <15487.1531150466@sss.pgh.pa.us> Message-ID: Date: Mon, 9 Jul 2018 20:06:00 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <15487.1531150466@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-MW List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 07/09/2018 11:34 AM, Tom Lane wrote: > Marc Cousin writes: >> This is a really simple test case, I think it's an unintended >> consequence of CVE-2018-1058: >> demo=# create extension hstore; >> CREATE EXTENSION >> demo=# create table test (a hstore); >> CREATE TABLE >> demo=# create index idx_test_not_distinct on test(a) where a is not >> distinct from ''; >> CREATE INDEX >> [ whereupon dump/restore fails with ] >> CREATE INDEX idx_test_not_distinct ON public.test USING btree (a) WHERE >> (NOT (a IS DISTINCT FROM ''::public.hstore)); >> psql:/tmp/demo_bug:73: ERROR: operator does not exist: public.hstore = >> public.hstore > Yeah, the core of the problem here is that there's no way to > schema-qualify IS [NOT] DISTINCT FROM's choice of underlying operator. > It was possible to ignore that as long as the operator you wanted > was in the search path, but now that we've tightened up pg_dump's > search path settings, we can't play fast and loose anymore. > > I think the most practical way to deal with this probably is to change > the parser so that the lookup works by finding a default btree or hash > opclass rather than by looking for "=" by name. We've made similar > changes in the past to get rid of implicit dependencies on operator > names, but those efforts never reached IS [NOT] DISTINCT FROM. > > I have a nasty feeling that there are still operator name dependencies > elsewhere, notably in CASE expressions, but haven't researched it yet. > > Although this doesn't seem like an outlandish change to make in HEAD, > back-patching it might cause some issues. On the other hand, I don't > see what choice we have. Leaving things as they stand isn't very > workable, and inventing some kind of schema-qualification syntax for > IS [NOT] DISTINCT FROM is surely even worse from a backwards > compatibility standpoint. I agree with your approach, including backpatching. I guess we'll have to try to think of some scenario that backpatching would break. Maybe to minimize any effect it should fall back on a default opclass if the search for "=" fails? Dunno how practical that is. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services