Re: Failure to coerce unknown type to specific type - Mailing list pgsql-bugs

From Jeff Davis
Subject Re: Failure to coerce unknown type to specific type
Date
Msg-id 1428560300.2845.45.camel@jeff-desktop
Whole thread Raw
In response to Re: Failure to coerce unknown type to specific type  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Wed, 2015-04-08 at 21:31 -0400, Tom Lane wrote:
> Jeff Davis <pgsql@j-davis.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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Failure to coerce unknown type to specific type
Next
From: eshkinkot@gmail.com
Date:
Subject: BUG #13010: After promote postgres try to send old timeline WALs to archive