Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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];

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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group