Re: Failure to coerce unknown type to specific type

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Failure to coerce unknown type to specific type
Date: 2015-04-09 06:18:20
Message-ID: 1428560300.2845.45.camel@jeff-desktop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Wed, 2015-04-08 at 21:31 -0400, Tom Lane 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.

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message eshkinkot 2015-04-09 14:02:18 BUG #13010: After promote postgres try to send old timeline WALs to archive
Previous Message digoal 2015-04-09 02:43:55 BUG #13004: PostgreSQL 9.5 policy for table bug?

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2015-04-09 06:47:02 Re: Row security violation error is misleading
Previous Message Fujii Masao 2015-04-09 04:14:24 Re: Proposal : REINDEX xxx VERBOSE