Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XMHxR-0000iX-CN for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Aug 2014 14:42:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XMHxQ-0007xn-SP for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Aug 2014 14:42:48 +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 1XMHxP-0007xH-Sy for pgsql-bugs@postgresql.org; Tue, 26 Aug 2014 14:42:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XMHxI-0000WJ-Vj for pgsql-bugs@postgresql.org; Tue, 26 Aug 2014 14:42:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s7QEgWSb010897; Tue, 26 Aug 2014 10:42:33 -0400 From: Tom Lane To: zoulx1982@163.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #11266: failed to find conversion function from unknown to bigint In-reply-to: <20140826062110.2532.26317@wrigleys.postgresql.org> References: <20140826062110.2532.26317@wrigleys.postgresql.org> Comments: In-reply-to zoulx1982@163.com message dated "Tue, 26 Aug 2014 06:21:10 -0000" Date: Tue, 26 Aug 2014 10:42:32 -0400 Message-ID: <10896.1409064152@sss.pgh.pa.us> 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 zoulx1982@163.com writes: > select s.* > from > (select a, null b from t1 > group by a > ) s > union all > select x,y from t2;--ERROR > is there parameters to avoid the issue without changing original sql, > or doe's somebody can fix the issue later ? No, and no. You need to cast the NULL literal to some specific datatype (in this example, you want the type of t2.y). A bare NULL like this is illegal per SQL standard; you're always supposed to cast it, or else write it in a place like an INSERT list where the null's type can be inferred from immediate context. Most real DBMSes allow you to violate that rule to some extent, but you should not be surprised that the exact places where you can get away with it vary from product to product. Postgres is not exactly like Oracle in this respect, and we're unlikely to try to make it so. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs