From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Jeff Davis <pgsql(at)j-davis(dot)com>, Postgres-Bugs <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: Failure to coerce unknown type to specific type |
Date: | 2015-04-29 22:37:51 |
Message-ID: | 35651.1430347071@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, Apr 8, 2015 at 9:31 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Jeff Davis <pgsql(at)j-davis(dot)com> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Georgi Georgiev | 2015-04-30 01:19:31 | Re: BUG #13182: pgadmin3 not showing in application list |
Previous Message | Robert Haas | 2015-04-29 21:50:15 | Re: Failure to coerce unknown type to specific type |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-04-29 22:44:52 | Re: alternative compression algorithms? |
Previous Message | Jim Nasby | 2015-04-29 22:29:31 | Re: Reducing tuple overhead |