Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wjgcn-0001Hl-QY for pgsql-bugs@arkaria.postgresql.org; Mon, 12 May 2014 03:09:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wjgcm-0000Mp-4h for pgsql-bugs@arkaria.postgresql.org; Mon, 12 May 2014 03:09:56 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wjgck-0000Mg-4E for pgsql-bugs@postgresql.org; Mon, 12 May 2014 03:09:54 +0000 Received: from mout.kundenserver.de ([212.227.17.13]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wjgca-0000aa-T3 for pgsql-bugs@postgresql.org; Mon, 12 May 2014 03:09:53 +0000 Received: from ayaki.localdomain (106-69-109-175.dyn.iinet.net.au [106.69.109.175]) by mrelayeu.kundenserver.de (node=mreue103) with ESMTP (Nemesis) id 0LdL6H-1XASiV0oaX-00iX0B; Mon, 12 May 2014 05:09:43 +0200 Message-ID: <53703B71.2080807@2ndquadrant.com> Date: Mon, 12 May 2014 11:09:37 +0800 From: Craig Ringer Organization: 2nd Quadrant User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: pgsql-bugs Subject: Re: hstore dump/restore bug in 9.3 References: <53702D20.4070505@2ndquadrant.com> <53702F92.50404@2ndquadrant.com> In-Reply-To: <53702F92.50404@2ndquadrant.com> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:GSIGEvOEcowLJSPrHuVsPkUPJVAN47U1lLWPcqXQWV6 Na5bsH27s+mbidtJUbPCR4T6/cqZhw00aiORWFLiLwQRjYn0jw 0IQbGaWEzMcGe0ExgYnDaKEkGyDLBYTXwRdxwBlKx2cDi+6ghU UagT0aKmkyI5RsjwNwqebKLLmUNCz/jwzkBtj9+/cl2YxrT2wJ FvPydNFRaO1OITwxNbMAjhtBZKnXNXDfMTnFRH2w5nUvB6vVlQ dJi5ZS2DGvfGNWVYFBu2ufmzqkVllL4q6kMRbbKFu/Ohcwe5B3 gEcwpZjzhhNX+iPsZji7n7TsqbXbDeKir30hX0/Qq+T93dlhf0 UfichzlvrZttlG/kjAxBP6ktHHW0kGRFM4eiZtcUp X-Pg-Spam-Score: -1.9 (-) 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 05/12/2014 10:18 AM, Craig Ringer wrote: > Do we need a way to schema-qualify the operator used in NULLIF, or to > provide an operator alias that it gets dumped as? A bit more digging shows that this doesn't affect LEAST or GREATEST, which I'd expect it to as well. Nor DISTINCT (otherwise someone would've yelled long ago). LEAST and GREATEST look up the operators from the b-tree opclass for the type(s) they're operating on using the type cache. So they don't care about search_path, they respect the schema of the base type they're operating on, per the case for T_MinMaxExpr in executor/execQual.c . NULLIF does not do so, per the case in T_NullIfExpr. But we don't actually get that far. The immediate failure is actually: hstore_test=# \set VERBOSITY verbose hstore_test=# CREATE VIEW hstore_test_schema.hstore_test_view AS SELECT NULLIF(column1, column2) AS comparison FROM hstore_test_schema.hstore_test_table; ERROR: 42883: operator does not exist: public.hstore = public.hstore LINE 2: SELECT NULLIF(column1, column2) AS comparison FROM hstore_te... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. LOCATION: op_error, parse_oper.c:722 which dies in: #2 0x000000000051ad34 in make_op (pstate=pstate@entry=0x1189f38, opname=0x1189c10, ltree=ltree@entry=0x118a528, rtree=0x118a590, location=58) at parse_oper.c:770 #3 0x00000000005155e1 in transformAExprNullIf (a=0x1189bc0, pstate=0x1189f38) at parse_expr.c:1021 instead of using the b-tree opclass of the base type to find the operator. This looks like a bug that'll want backpatching and it's not a data loss risk, so I don't think it's urgent to shove this in before 9.4 closes. I'll look for time to try out a possible fix soon, after reading all the code that shows how DISTINCT and GREATEST/LEAST handle this in detail. I'm hard up against a deadline at the moment so it'll be a little while. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs