| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Chuck McDevitt" <cmcdevitt(at)greenplum(dot)com> |
| Cc: | "Andrew Hammond" <andrew(dot)george(dot)hammond(at)gmail(dot)com>, "Josh Berkus" <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org, "Dann Corbit" <DCorbit(at)connx(dot)com>, "Larry McGhaw" <lmcghaw(at)connx(dot)com> |
| Subject: | Re: Selecting a constant question: A summary |
| Date: | 2007-06-13 04:50:07 |
| Message-ID: | 1397.1181710207@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
"Chuck McDevitt" <cmcdevitt(at)greenplum(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joshua D. Drake | 2007-06-13 04:55:07 | Re: Selecting a constant question |
| Previous Message | Chuck McDevitt | 2007-06-13 04:30:27 | Re: Selecting a constant question: A summary |