Concat truncates at 257 characters - Mailing list pgsql-bugs

From Patrick Lademan
Subject Concat truncates at 257 characters
Date
Msg-id CADMm_6AakPuWNbRLKvj6LjkdSyc7r=NKLd5Q0x36itCMRp2phA@mail.gmail.com
Whole thread Raw
Responses Re: Concat truncates at 257 characters  (John R Pierce <pierce@hogranch.com>)
Re: Concat truncates at 257 characters  (David Johnston <polobo@yahoo.com>)
List pgsql-bugs
Hello,

My automated database unit tests compare the actual result to the expected
result then provides a pass or fail status.  When it fails, it constructs a
difference string with an ^ pointing to each mismatching character between
the two.  Some of my tests have very long strings of data used to validate
that a function is working correctly under very specific test conditions.
 The problem is that the concat and || are truncating the result.

The following simple examples all truncate at 257 characters and add a
trailing " (...)".

select rpad('', 200, 'A') || rpad('', 200, 'B');

select rpad('', 200, 'A')::text || rpad('', 200, 'B')::text;

select cast( rpad('', 200, 'A')::text || rpad('', 200, 'B')::text as text );

select cast( rpad('', 200, 'A') as text ) || cast( rpad('', 200, 'B') as
text );

select cast( cast( rpad('', 200, 'A') as text ) || cast( rpad('', 200, 'B')
as text ) as text);

select concat( rpad('', 200, 'A'), rpad('', 200, 'B') );

select concat( rpad('', 200, 'A')::varchar(4000) , rpad('', 200,
'B')::varchar(4000)  )::varchar(4000);

select concat( rpad('', 200, 'A')::text , rpad('', 200, 'B')::text  )::text;

Database:
"PostgreSQL 9.3.1 on x86_64-apple-darwin, compiled by
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build
5658) (LLVM build 2336.9.00), 64-bit"

Mac:
  System Version: OS X 10.9 (13A603)
  Kernel Version: Darwin 13.0.0

How can I extend the concat beyond 257?

Thank you,

Pat

pgsql-bugs by date:

Previous
From: Vik Fearing
Date:
Subject: Re: BUG #8630: Planner behavior change between PG 9.0.14 and 9.3.1
Next
From: John R Pierce
Date:
Subject: Re: Concat truncates at 257 characters