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

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: [BUGS] Failure to coerce unknown type to specific type
Дата
Msg-id CAMp0ubehp_j16rhLLuNhut6iVkdaGZyJ2F3u0sRk5wtvCwMCvg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [BUGS] Failure to coerce unknown type to specific type  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: [BUGS] Failure to coerce unknown type to specific type  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-hackers
On Thu, Apr 23, 2015 at 1:49 AM, David G. Johnston
<david.g.johnston@gmail.com> wrote:
> Reading and writing all this I'm convinced you have gotten the idea in your
> mind an expectation of equivalency and consistency where there really is
> little or none from an overall design perspective.  And none insofar as
> would merit trying to force the two example queries you provide to behave
> identically.  There are a number of things about SQL that one either simply
> lives with or goes through mind contortions to understand the, possibly
> imperfect, reasoning behind.  This is one of those things: and while it's
> been fun to do those contortions in the end I am only a little bit better
> off than when I simply accepted the fact the unknown and untyped were
> similar but different (even if I hadn't considered giving them different
> names).

You make some good points, but I disagree for two reasons:

1. This is a postgres issue, not a general SQL issue, so we can't
simply say "SQL is weird" (like we can with a lot of the strange NULL
semantics).
2. Postgres has determined that the unknown column reference "b" in
the query "SELECT a=b FROM (SELECT ''::text, '  ') x(a,b)" can and
should be coerced to text. So postgres has already made that decision.
It's just that when it tries to coerce it, it fails. Even if you
believe that literals and column references are not equivalent, I
don't see any justification at all for this behavior -- postgres
should not decide to coerce it in the first place if it's going to
fail.

Regards,   Jeff Davis



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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: adding more information about process(es) cpu and memory usage
Следующее
От: Jeff Janes
Дата:
Сообщение: Re: improving speed of make check-world