Re: BUG #12917: C program created by ecpg core dumped due to "varcharsize * offset" - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: BUG #12917: C program created by ecpg core dumped due to "varcharsize * offset"
Date
Msg-id CAB7nPqT4fTkN5+fG08h2i_f308BsZdu8rWZnJQ+ET2m9rb6WVw@mail.gmail.com
Whole thread Raw
In response to BUG #12917: C program created by ecpg core dumped due to “varcharsize * offset”  (chjischj@163.com)
Responses Re: BUG #12917: C program created by ecpg core dumped due to "varcharsize * offset"  (chenhj <chjischj@163.com>)
List pgsql-bugs
On Mon, Mar 30, 2015 at 8:13 PM, <chjischj@163.com> wrote:
>
> Table and data:
> create table empl(idnum integer, name char (10000000));
> insert into empl values(1,'abcdddd1123444ddffdfdffddfdfffd');

So the table used in your test uses char(10000000), which is a
datatype that completes with spaces strings stored that have a length
shorter than the limit. So even if you store a string of n characters,
what will be stored are those n characters, followed by 10,000,000 - n
spaces.

>
> EXEC SQL BEGIN DECLARE SECTION;
> struct TBempl
> {
>   long idnum;
>   char name[10000];
> };


And this test expects that result of column "name" does not contain
more 10k characters, so your data set is incompatible with your test,
explaining the crash you are seeing.
--
Michael

pgsql-bugs by date:

Previous
From: Pavel Stehule
Date:
Subject: to high memory expensive xpath_table from xml2 contrib extension
Next
From: Michael Paquier
Date:
Subject: Re: PQexec() hangs on OOM