Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yp0Ac-0003Sj-1d for pgsql-bugs@arkaria.postgresql.org; Sun, 03 May 2015 20:07:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yp0Ab-00081u-FA for pgsql-bugs@arkaria.postgresql.org; Sun, 03 May 2015 20:07:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yp0Aa-00081e-Hy for pgsql-bugs@postgresql.org; Sun, 03 May 2015 20:07:20 +0000 Received: from nm26.bullet.mail.ne1.yahoo.com ([98.138.90.89]) by magus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Yp0AX-0003Ww-3x for pgsql-bugs@postgresql.org; Sun, 03 May 2015 20:07:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s2048; t=1430683634; bh=mX5eqc7UwtEmct3/2V5NHVQ9h343RMjk2oLUHxS7+oU=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:From:Subject; b=tpiUeskUcWUWrWg74ppRpMeuXtqXwH+6djdZwk4e71KcXQmv6HCiHS9w0m2g7OfLTSXWDatd9/IM1DGv41IMYn2yNf/GzpWG8ruTy9v+yIE4irCcN/SVRkUguEs+di5YmadmeiB/RYxdbnjzne8UGCXPIoSw2hTuHYZEoLNGHWi33LZ7JKJ9v4K9ZfLI6PuArpICX5nKyhjzBOMpM6C4QTLQS0X9G86b3N3sV+yq5kCfhewnLrsqAuamRZNBEWvhXjDIfQurXgQd2erlz5WCEi47mfXn4HfFISthi0OJ8dXDJsR0W6etHJzMtjtGLQBPBDKF6ms3RttWGbBBrMSQdQ== Received: from [98.138.100.113] by nm26.bullet.mail.ne1.yahoo.com with NNFMP; 03 May 2015 20:07:14 -0000 Received: from [98.138.89.170] by tm104.bullet.mail.ne1.yahoo.com with NNFMP; 03 May 2015 20:07:14 -0000 Received: from [127.0.0.1] by omp1026.mail.ne1.yahoo.com with NNFMP; 03 May 2015 20:07:14 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 819865.41714.bm@omp1026.mail.ne1.yahoo.com X-YMail-OSG: ExPPS8QVM1k1RwECWE0FSRbt7TktDVDGIWOfHIwV7dMktz7sQQJZCP4xMY16WtK ScNxgFO52ZOho0IuvG0mhjcPCGPflx_YX4N1qlvLUCuXmpbQouChQcM2uyHIAPYc9yxxuANqtnll g7p5_4l1R1FaoLwSmpBYIU3.dgybHED_LKZ9yAg6kNC8hLJPXw2mEC7AushyUebDhaVHnGQkR7TI 7wZvo1TrZ7zo8Fe0Nwlck8tu5kywjq9Q0OkVTm9nxtfxOu3ZbyvbtXtSQpYyyWjqyGjpl5kgvnC8 c73HKJgmtFfRGGPl0NRNTYboXJgM020QbTc5b7mI0YHKear.I9S712NBXIFYikWp8PrpPEv1bVDw RtA9mseDoxcxcgsIEZzKJDi53NJLlzdLN4W5LCJL4ERDv4pSsM6pdpg1Vwr3_6rK7zPbEx.48z5U UeO4dlVQ_s8ZnvLDPv6tEoIx6d4KYiaoYO9LQCGc4jm7kOC0v72QqzdLMCiZbU0YrwMh3.EWkLFG nM32eVDGGEIYm.3lDETOyeKSKdpyoUN.gYDKusw5ibp_CDJ1M7i7M Received: by 98.138.105.224; Sun, 03 May 2015 20:07:14 +0000 Date: Sun, 3 May 2015 20:07:13 +0000 (UTC) From: Kevin Grittner Reply-To: Kevin Grittner To: Tom Lane Cc: Robert Haas , Jeff Davis , Postgres-Bugs Message-ID: <1648216624.644283.1430683633940.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: <23845.1430681631@sss.pgh.pa.us> References: <23845.1430681631@sss.pgh.pa.us> Subject: Re: Failure to coerce unknown type to specific type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Length: 1895 X-Pg-Spam-Score: -2.0 (--) 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 Tom Lane wrote: > This is irrelevant, because such a construct fails the syntax rules > and thus we never get to the question of what type should be inferred, > at least not without going outside the spec. See my other reply. Yeah, our posts have been crossing a bit. The point about not allowing a NULL literal is valid. I yield on that regarding COALESCE within the spec. It is an extension to the spec to allow a NULL literal within a COALESCE clause at all. We would surely break a lot of working code to forbid it, though. If we *are* going to allow it, it would be pretty confusing to have it behave differently that what I previously outlined (regarding the equivalent long form CASE clause). The from a long form of the CASE clause explicitly does explicitly allow an untyped NULL literal, and forcing it to text is wrong per section 9.3. To save an extra post -- I did modify the statements in SQL Fiddle to get to the point where the subquery returned a column without a type and a column with an int type in the dialect supported. I'm not sure how that's relevant to the issue about how they resolve that in the outer query, but I can post the form of the query used for each product if you think it is germane. To restate it, this hardly seems like the most important issue to address; I just don't think the standard gives us much cover here. What we do for the CASE clause is clearly wrong per spec, and if we allow a bare NULL in a COALESCE clause it would be crazy not to have the behavior match CASE. But it is clearly good form to always cast a NULL literal to some type, and that is a workaround which should not be too painful for most people. We shouldn't rush to do anything big here, but we should recognize where we stand. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs