BUG #1774: ecpg preprocessor produces a wrong varchar struct

Поиск
Список
Период
Сортировка
От Dirk Jagdmann
Тема BUG #1774: ecpg preprocessor produces a wrong varchar struct
Дата
Msg-id 20050718164017.2F523F0AC6@svr2.postgresql.org
обсуждение исходный текст
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      1774
Logged by:          Dirk Jagdmann
Email address:      doj@cubic.org
PostgreSQL version: 8.0.3
Operating system:   i686 Linux 2.6
Description:        ecpg preprocessor produces a wrong varchar struct
Details:

The ecpg preprocessor produces wrong code which does not compile.

--- input.pgc ---
int main()
{
  EXEC SQL BEGIN DECLARE SECTION;
  VARCHAR v;
  EXEC SQL END DECLARE SECTION;
  return 0;
}
-------------------

Now process it with "ecpg input.pgc" which results in:
--- input.c ---
/* Processed by ecpg (4.0.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "input.pgc"
int main()
{
  /* exec sql begin declare section */
#line 4 "input.pgc"
   struct varchar_v  { int len; char arr[ -1 ]; }  v   ;
/* exec sql end declare section */
#line 5 "input.pgc"
  return 0;
}
---------------

The array size of the struct is -1 and this does not compile:
input.pgc: In function `main':
input.pgc:4: error: size of array `arr' is negative

I suppose the size should have been 0 so it can be malloced by the backend.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #1756: PQexec eats huge amounts of memory
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: BUG #1756: PQexec eats huge amounts of memory