Re: Selecting a constant question: A summary - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Selecting a constant question: A summary
Date
Msg-id 87myz4ci1v.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Selecting a constant question: A summary  ("Chuck McDevitt" <cmcdevitt@greenplum.com>)
List 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)?

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



pgsql-hackers by date:

Previous
From: Dave Page
Date:
Subject: EXPLAIN omits schema?
Next
From: Heikki Linnakangas
Date:
Subject: Re: comparing index columns