Re: Selecting a constant question: A summary

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Chuck McDevitt" <cmcdevitt(at)greenplum(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "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 09:36:28
Message-ID: 87myz4ci1v.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | 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)?

Even if it was assigned a text datatype it would be the unconstrainted "text"
not varchar(1). If we used varchar(1) then things like:

create table foo as select 'foo';

would create a table with varchar(3) which would then complain if you tried to
insert 'foobar' into. There doesn't seem to be enough evidence that the user
intended to constrain the input to just 'foo' in that case.

Of course right now you get a table with a column of type "unknown" which is
very unlikely to be what the user expects.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2007-06-13 09:54:01 Re: comparing index columns
Previous Message Dave Page 2007-06-13 09:25:35 EXPLAIN omits schema?