Re: Selecting a constant question: A summary

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Selecting a constant question: A summary
Дата
Msg-id 1397.1181710207@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Selecting a constant question: A summary  ("Chuck McDevitt" <cmcdevitt@greenplum.com>)
Ответы Re: Selecting a constant question: A summary  ("Chuck McDevitt" <cmcdevitt@greenplum.com>)
Список pgsql-hackers
"Chuck McDevitt" <cmcdevitt@greenplum.com> writes:
> Just a curiosity question:  Why is the type of a literal '1' "unknown"
> instead of varchar(1)?

Because, for instance, it might be intended as an integer or float or
numeric value.  Change the content a little, like '(1,2)' or '12:34',
and maybe it's a point or time value.  There are plenty of contexts in
which the intended type of a literal is obviously not text/varchar.

We assign unknown initially as a way of flagging that the type
assignment is uncertain.  Once we have a value that we think is varchar
(a table column for instance), the rules for deciding to cast it to a
different type get a lot more stringent.
        regards, tom lane


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

Предыдущее
От: "Chuck McDevitt"
Дата:
Сообщение: Re: Selecting a constant question: A summary
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Selecting a constant question