"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