Re: Bug in CREATE FUNCTION with character type (CONFIRMED BUG) - Mailing list pgsql-bugs

From Craig Ringer
Subject Re: Bug in CREATE FUNCTION with character type (CONFIRMED BUG)
Date
Msg-id 4BC68078.3060302@postnewspapers.com.au
Whole thread Raw
In response to Re: Bug in CREATE FUNCTION with character type (CONFIRMED BUG)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug in CREATE FUNCTION with character type (CONFIRMED BUG)
Next
From: Bruce Momjian
Date:
Subject: Re: BUG #5420: pg_attribute broken