Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YoydH-0006K9-Hl for pgsql-bugs@arkaria.postgresql.org; Sun, 03 May 2015 18:28:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YoydH-0004Y1-13 for pgsql-bugs@arkaria.postgresql.org; Sun, 03 May 2015 18:28:51 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YoydF-0004Ve-8x for pgsql-bugs@postgresql.org; Sun, 03 May 2015 18:28:49 +0000 Received: from nm24-vm0.bullet.mail.ne1.yahoo.com ([98.138.90.34]) by makus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1YoydC-0001LS-7S for pgsql-bugs@postgresql.org; Sun, 03 May 2015 18:28:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s2048; t=1430677724; bh=/l+PxA8S1lIiFrwEuuUqjSxTTtdWeU5vQRHa62jMSGs=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:From:Subject; b=FwJlopLkbSY0za3i3ErgVY+7JE1Wz90rQSUmu0tmP/JiK1nTiAAZ/uSUPOM1nMiDR0LqI8SX0SlZyGxb6bl3Dn8pb+pjsoII5UH7O7nAPR55B8y31FcRp/hTrt29zBMDPpunkALXuQ5wrO0o22DrzQ8RMRmIpB3MnEpVx1IZA5FgmVmYqiP1DAwRuXG4//ZtBkeKTbEriPFvuMNywZffwKOvOB20LbALWNfeZ/W6mEMAdLSt+Ru6chroAht0Gx+aClWZeGcVt9DdJ8d5k3E8fSgIQlxx8/dw6pfW8PS0MVW88ppH83HJyOP1ubTZ0X9AjnO04O0s7rdCg+utTOVxgg== Received: from [98.138.101.132] by nm24.bullet.mail.ne1.yahoo.com with NNFMP; 03 May 2015 18:28:44 -0000 Received: from [98.138.89.162] by tm20.bullet.mail.ne1.yahoo.com with NNFMP; 03 May 2015 18:28:44 -0000 Received: from [127.0.0.1] by omp1018.mail.ne1.yahoo.com with NNFMP; 03 May 2015 18:28:44 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 196009.65407.bm@omp1018.mail.ne1.yahoo.com X-YMail-OSG: i8aIKroVM1mwWe0IUv_o.3AL_XOgrQ5go3BASHOC5CaIbjTF4kFIXzgEH8AIQi8 HSUfJMEHYdiiVmVdEaEFtC2z9ajPmtz3SGHO9c4._2UdAHq_dL2ROb__bcMYHg_N4M1LxSQs6i3n QTJXf_e0uu3WBuDXpka5CXhYBrWelIwpuTFZ2Q.exVg7_GDF9n7pulSCq1rnxEQRAh1mMPpgYs1i 4y01L8wjwRLUbnh9i87nRgoVlTe4Ltcg0thOQ5vmZIkKq_RRIJx_5EWsPv1yl.IlgX1twanHUlVO rXN9yuwrYdKC8opIcMBCjP_8eWyG8c_fAn20DT8KN6M5Ek.8kxyBJ1UAFKYh19XCLndlsBXAQ5FT xYWevr9iSlt1MZkBTQrgiz1WipANnaEmUWSe9LTTUSXf7.ZFxGq9PmiJZ0R2KtBfnAmaYW0xgrSL GGEtd2y3rVHWj2C41LBRx7XnlYHH6YlUbcgdn0IW0CPNoN0B7w9IUgxjn_msNX9uJx9yyagC1_Ov FYK.wzuAcaSqLboOFVh1DRWXih_V0Z8oKTz8GyN1wLHKGBT0mNA-- Received: by 98.138.105.243; Sun, 03 May 2015 18:28:43 +0000 Date: Sun, 3 May 2015 18:28:07 +0000 (UTC) From: Kevin Grittner Reply-To: Kevin Grittner To: Tom Lane , Jeff Davis Cc: Robert Haas , Postgres-Bugs Message-ID: <1378610475.587034.1430677687479.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: <16364.1430672448@sss.pgh.pa.us> References: <16364.1430672448@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: 1766 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: > Jeff Davis writes: >> On Fri, 2015-05-01 at 10:08 -0700, Tom Lane wrote: >>> What really ought to happen here, IMO, is that the output >>> columns of the sub-select ought to get resolved to non-unknown >>> types while we are doing parse analysis of the sub-select. >> >> So, what would happen for something like: >> select u+i from (select '1' as u, '2'::int as i) s; > > I don't think there's any useful alternative to failing on this > type of case. You can't realistically postpone resolution of the > subquery output types long enough for outer-level expression > resolution to provide context. According to SQL Fiddle: MySQL, SQL Lite, and MS SQL Server all come up with 3 as the answer. Oracle 11g R2 (with a one-row table to avoid the "FROM keyword not found where expected" error) gives this rather cryptic message: ORA-00933: SQL command not properly ended If I pull out the subquery and run it by itself Oracle gives this: Invalid SQL type: sqlKind = UNINITIALIZED > Even if you could, the behavior wouldn't be very well defined, > because (as you note) there might be more than one such > expression leading to contradictory results. Do you have a simple example of what you mean? I'm kinda curious whether the products that manage to handle the above give a sane error when it becomes ambiguous, or whether they fail in confusing ways. It's not like I feel that we need to support a statement just because other products do, but when I respond to complaints from users trying to migrate to PostgreSQL, it is useful to have examples to demonstrate the down side of what other products are doing. -- 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