Bug #606: exec sql ifdef, ... incorrect parsing

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #606: exec sql ifdef, ... incorrect parsing
Date: 2002-03-04 06:57:41
Message-ID: 20020304065741.1878C47587E@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Nicolas BAZIN (nbazin(at)ingenico(dot)com(dot)au) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
exec sql ifdef, ... incorrect parsing

Long Description
When exec sql ifdef test; is used with the definition of a statement bloc, a premature EOF is reached:

Sample Code
Lets modify test1.pgc with

static void warn(void)
{
fprintf(stderr, "Warning: At least one column was truncated\n");
}

/* comment */
exec sql define test 1;
exec sql ifdef test;
exec sql define AMOUNT 6;
exec sql else;
exec sql define AMOUNT 7;
exec sql endif;

exec sql type intarray is int[AMOUNT];
exec sql type string is char(8);

typedef int intarray[AMOUNT];

int
main ()
{
exec sql begin declare section;
intarray amount;
int increment=100;
char name[AMOUNT][8];
char letter[AMOUNT][1];
exec sql ifdef test;
struct name_letter_struct
{
char name[8];
int amount;
char letter;
} name_letter[AMOUNT];
exec sql endif;
struct ind_struct
{
short a;
short b;
short c;
} ind[AMOUNT];
char command[128];
char *connection="pm";
exec sql end declare section;
exec sql var name is string(AMOUNT);
char msg[128];
FILE *dbgs;
int i,j;
....

[postgres(at)CVS test]$ gmake
../preproc/ecpg -I./../include test1.pgc
test1.pgc:45: ERROR: eof - Missing 'EXEC SQL ENDIF;'
gmake: *** [test1.c] Error 3
gmake: *** Deleting file `test1.c'

No file was uploaded with this report

Browse pgsql-bugs by date

  From Date Subject
Next Message Reinhard Max 2002-03-04 11:10:39 Re: Indexes not always used after inserts/updates/vacuum
Previous Message Steven N=?ISO-8859-1?B?+vE=?=ez 2002-03-04 05:44:49 Re: Make check problem with 7.2