Re: BUG #12917: C program created by ecpg core dumped due to "varcharsize * offset"

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: chjischj(at)163(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #12917: C program created by ecpg core dumped due to "varcharsize * offset"
Date: 2015-04-06 02:23:34
Message-ID: CAB7nPqT4fTkN5+fG08h2i_f308BsZdu8rWZnJQ+ET2m9rb6WVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Mar 30, 2015 at 8:13 PM, <chjischj(at)163(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2015-04-06 06:54:37 Re: PQexec() hangs on OOM
Previous Message Pavel Stehule 2015-04-05 05:06:20 to high memory expensive xpath_table from xml2 contrib extension