Re: [BUGS] Failure to coerce unknown type to specific type

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: [BUGS] Failure to coerce unknown type to specific type
Дата
Msg-id CAMp0ubdVJAC+yO5XqU=M08WyXX19jnk9r2Faeo5W-SVDWAKzZA@mail.gmail.com
обсуждение исходный текст
Ответы Re: [BUGS] Failure to coerce unknown type to specific type  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-hackers
Moving thread to -hackers.

On Wed, Apr 8, 2015 at 11:18 PM, Jeff Davis <pgsql@j-davis.com> wrote:
> 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'?

Is the behavior of unknown literals vs. unknown column references
documented anywhere? I tried looking here:
http://www.postgresql.org/docs/devel/static/typeconv.html, but it
doesn't seem to make the distinction between how unknown literals vs.
unknown column references are handled.

My understanding until now has been that unknown types are a
placeholder while still inferring the types. But that leaves a few
questions:

1. Why do we care whether the unknown is a literal or a column reference?
2. Unknown column references seem basically useless, because we will
almost always encounter the "failure to find conversion" error, so why
do we allow them?
3. If unknowns are just a placeholder, why do we return them to the
client? What do we expect the client to do with it?

Regards,   Jeff Davis



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: tablespaces inside $PGDATA considered harmful