Re: Selecting a constant question: A summary
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Chuck McDevitt" <cmcdevitt@greenplum.com>
Cc: "Andrew Hammond" <andrew.george.hammond@gmail.com>, "Josh Berkus" <josh@agliodbs.com>, pgsql-hackers@postgresql.org, "Dann Corbit" <DCorbit@connx.com>, "Larry McGhaw" <lmcghaw@connx.com>
Date: 2007-06-13T04:50:07Z
Lists: 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