Concat truncates at 257 characters

From: Patrick Lademan <mjfrog14(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Concat truncates at 257 characters
Date: 2013-11-25 23:09:25
Message-ID: CADMm_6AakPuWNbRLKvj6LjkdSyc7r=NKLd5Q0x36itCMRp2phA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message John R Pierce 2013-11-25 23:17:30 Re: Concat truncates at 257 characters
Previous Message Vik Fearing 2013-11-25 22:07:20 Re: BUG #8630: Planner behavior change between PG 9.0.14 and 9.3.1