Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yg5nO-0001RR-1m for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Apr 2015 06:18:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yg5nM-0006B3-O1 for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Apr 2015 06:18:32 +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 1Yg5nK-0006At-Rg for pgsql-bugs@postgresql.org; Thu, 09 Apr 2015 06:18:30 +0000 Received: from mail-pd0-f177.google.com ([209.85.192.177]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Yg5nG-0000dW-BW for pgsql-bugs@postgresql.org; Thu, 09 Apr 2015 06:18:29 +0000 Received: by pddn5 with SMTP id n5so141869484pdd.2 for ; Wed, 08 Apr 2015 23:18:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-type:mime-version:content-transfer-encoding; bh=5zLOeCn3YEZ8TcNXIRww4dKBxDzIYf7fpokdRaGJ8gU=; b=Li9ur+vp/Q7imoVRic1Z3TH5PnwZ8RsK/g/oKs+C4hBuBzLk8Gqp6gEZBQKiKpEXqN x+pZUHQ4h9CseWZFdvK5GXTekslegqTJWBIJexUGS3I6OIzCcTR79LhyCJR2PLkagcHm YvM1ar/UBSfQ0xmAi7tUevfejLEyp2yv+On6eeWeCp53gIx9Vc0iQDBClRkKdNxwWxPE Yfzagaf6bhFehqlJ35Ae18diKbYex9/T8I453zTJeif3fsaLJQaUqz2UjIlDKmylqDpu +tYjQL+CynwsplR+cki9YQJoE9xt4Dkg7dXE8RzWm8nrwi0CJkezreyzmvNFrZsEZUZV 10eg== X-Gm-Message-State: ALoCoQkCuOUtXABg/noHT9ag4FHqw5zRyOu1a64VvoaBgPZ2DpYlanVmUWjt7Qx4EBz3dTuxZk+p X-Received: by 10.66.221.193 with SMTP id qg1mr52016658pac.134.1428560303306; Wed, 08 Apr 2015 23:18:23 -0700 (PDT) Received: from [192.168.0.108] (c-69-181-249-16.hsd1.ca.comcast.net. [69.181.249.16]) by mx.google.com with ESMTPSA id gl2sm12999618pbc.52.2015.04.08.23.18.21 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Wed, 08 Apr 2015 23:18:22 -0700 (PDT) Message-ID: <1428560300.2845.45.camel@jeff-desktop> Subject: Re: Failure to coerce unknown type to specific type From: Jeff Davis To: Tom Lane Cc: pgsql-bugs@postgresql.org Date: Wed, 08 Apr 2015 23:18:20 -0700 In-Reply-To: <1430.1428543112@sss.pgh.pa.us> References: <1430.1428543112@sss.pgh.pa.us> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) 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 Wed, 2015-04-08 at 21:31 -0400, Tom Lane wrote: > Jeff Davis writes: > > Original report and patch by Karl Schnaitter. > > create table a(u) as select '1'; > > We should, in fact, fail that to begin with. Unknown-type columns are > a spectactularly horrid idea. That example was just for illustration. My other example didn't require creating a table at all: SELECT a=b FROM (SELECT ''::text, ' ') x(a,b); it's fine with me if we want that to fail, but I don't think we're failing in the right place, or with the right error message. I'm not clear on what rules we're applying such that the above query should fail, but: SELECT ''::text=' '; should succeed. Unknown literals are OK, but unknown column references are not? If that's the rule, can we catch that earlier, and throw an error like 'column reference "b" has unknown type'? Regards, Jeff Davis -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs