Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YnacD-0001bY-NT for pgsql-bugs@arkaria.postgresql.org; Wed, 29 Apr 2015 22:38:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YnacD-0003fx-3B for pgsql-bugs@arkaria.postgresql.org; Wed, 29 Apr 2015 22:38:01 +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 1YnacC-0003fm-3O for pgsql-bugs@postgresql.org; Wed, 29 Apr 2015 22:38:00 +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 1Ynac8-0004oV-1v for pgsql-bugs@postgresql.org; Wed, 29 Apr 2015 22:37:59 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t3TMbonW001973; Wed, 29 Apr 2015 18:37:51 -0400 From: Tom Lane To: Robert Haas cc: Jeff Davis , Postgres-Bugs Subject: Re: Failure to coerce unknown type to specific type In-reply-to: References: <1430.1428543112@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Wed, 29 Apr 2015 17:50:15 -0400" Date: Wed, 29 Apr 2015 15:37:51 -0700 Message-ID: <35651.1430347071@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 Robert Haas writes: > On Wed, Apr 8, 2015 at 9:31 PM, 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. > I agree. So why don't we throw an error when someone tries to create one? We should IMO, but there's been push-back about backwards compatibility when this has been proposed in the past. But I'd rather break backwards compatibility to the extent of saying "you can't do that" than to try to make unknown a full-fledged type, which is what this patch wants to do. I have some recollection that we'd also put it off pending resolution of debates about how to handle unknown-type literals in UNIONs and similar contexts. But poking at such examples right now, the behavior seems generally reasonable: it seems like we resolve "unknown" as text when forced to make a decision, but otherwise put it off as long as possible. So that consideration may be obsolete. An alternative design that is also worthy of consideration is to force the created view or table column to be type text rather than unknown. But that would be more complex to implement, and it's not obviously superior to saying "hey bud, you need to be more specific as to what column type you intend here". 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