Re: column "b" is of type X but expression is of type text

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: column "b" is of type X but expression is of type text
Дата
Msg-id 1967.1373678283@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: column "b" is of type X but expression is of type text  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-hackers
Josh Berkus <josh@agliodbs.com> writes:
> The root cause of this is that we treat "default TEXT" the same as "real
> TEXT" as a type.

No, we do not do that at all.  A NULL is initially of type unknown, and
that is definitely not the same as text.  The type resolution rules
treat the two cases differently.

The real cause of what David is complaining about is that we resolve
expression datatypes bottom up.  Once we've determined that we're going
to consider foo(NULL) as an invocation of foo(text), that's what it is,
and the context won't cause us to go back and change that.

> Changing that logic, though, would require a massive
> refactoring and debugging of PostgreSQL.

This is true enough; and you forgot to mention all the existing
applications that would also need changes if we changed the expression
resolution rules.  We could possibly make marginal changes without too
much pain, but making function resolution context-dependent would hardly
be a marginal change.
        regards, tom lane



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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: --with-libedit-preferred is bad design
Следующее
От: Tom Lane
Дата:
Сообщение: Re: --with-libedit-preferred is bad design