Re: Implicit cast of literal in SQL statements

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: Implicit cast of literal in SQL statements
Дата
Msg-id 3C2B9295.91DD8559@fourpalms.org
обсуждение исходный текст
Ответ на Implicit cast of literal in SQL statements  (Scott Royston <scroyston71@yahoo.com>)
Ответы Re: Implicit cast of literal in SQL statements  (Scott Royston <scroyston71@yahoo.com>)
Список pgsql-bugs
> I've seen a few postings in multiple newsgroups saying that in 7.1.x and
> up, literals in SQL statements are implicitly cast to strings.

In some contexts, that statement is true, yes. The cases where this is
true is when the parser is trying to match literals with available
function calls. If there is a literal of unknown type, and if there is a
function which could take a string literal as input, then that function
is the one chosen.

> does this really work for everybody else?  Can someone point me to a
> compile flag I may be missing, or the code that actually does the
> implicit cast?

It looks like we are not handling the case where there is no explicit
function call, and there a string literal in the target list (so no
underlying column to infer a type from), and there is a subsequent
ordering operation. That might be fixable, but it may not be a useful
real world example afaict.

Do you have another example to illustrate the problem for a query which
one might actually need to use?

                     - Thomas

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

Предыдущее
От: Scott Royston
Дата:
Сообщение: Implicit cast of literal in SQL statements
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Implicit cast of literal in SQL statements