On 15/04/2010 10:25 AM, Tom Lane wrote:
> Craig Ringer<craig@postnewspapers.com.au> writes:
>> So - I do think there's a bug here, if _tables_ can be created with
>> character(1) fields containing three- or four-character strings.
>
> [ shrug... ] If you can demonstrate such a behavior, I'd agree it's a
> bug, but the examples at hand have nothing to do with what gets stored
> into tables.
regress=> CREATE TYPE testtype AS (id int, salesourcecode character);
CREATE TYPE
regress=> CREATE OR REPLACE FUNCTION test_char_function()
RETURNS SETOF testtype AS
$BODY$
VALUES (1, 'one'), (2, 'two'), (3, 'three');
$BODY$
LANGUAGE 'sql';
CREATE FUNCTION
regress=> SELECT * INTO test_tab FROM test_char_function();
SELECT
regress=> select * from test_tab;
id | salesourcecode
----+----------------
1 | one
2 | two
3 | three
(3 rows)
craig=> \d test_tab
Table "public.test_tab"
Column | Type | Modifiers
----------------+--------------+-----------
id | integer |
salesourcecode | character(1) |
--
Craig Ringer