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

Bug #599: ecpg does not parse correctly define and struct in the same file

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #599: ecpg does not parse correctly define and struct in the same file
Date: 2002-02-22 05:23:02
Message-ID: 20020222052302.E33EC475A78@postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
BAZIN Nicolas (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
ecpg does not parse correctly define and struct in the same file

Long Description
The following example does not get pre-processed:

EXEC SQL ifndef COMMERCANT;
EXEC SQL define COMMERCANT;


EXEC SQL define CMR_CODE                 10;
EXEC SQL define CMR_NUMCMR               7;
EXEC SQL define CMR_NOM                  32;
EXEC SQL define CMR_ABRVNOM              15;
EXEC SQL define CMR_ADRS1                32;
EXEC SQL define CMR_ABRVADRS             15;
EXEC SQL define CMR_ADRS2                32;
EXEC SQL define CMR_TEL                  15;
EXEC SQL define CMR_CODACTIVITE          4;
EXEC SQL define CMR_CODZONE              2;
EXEC SQL define CMR_CODBQE               5;
EXEC SQL define CMR_NUMBADGE             15;
EXEC SQL define CMR_DATDEBUT             10;
EXEC SQL define CMR_DATFIN               10;
EXEC SQL define CMR_TEST                 1;
EXEC SQL define CMR_PLFCODE              1;

EXEC SQL BEGIN DECLARE SECTION;
struct tcommercant
{
		char   cmr_code          [CMR_CODE+1];
		char   cmr_numcmr        [CMR_NUMCMR+1];
		char   cmr_nom           [CMR_NOM+1];
		char   cmr_abrvnom       [CMR_ABRVNOM+1];
		char   cmr_adrs1         [CMR_ADRS1+1];
		char   cmr_abrvadrs      [CMR_ABRVADRS+1];
		char   cmr_adrs2         [CMR_ADRS2+1];
		char   cmr_tel           [CMR_TEL+1];
		char   cmr_codactivite   [CMR_CODACTIVITE+1];
		char   cmr_codzone       [CMR_CODZONE+1];
		char   cmr_codbqe        [CMR_CODBQE+1];
		char   cmr_numbadge      [CMR_NUMBADGE+1];
		char   cmr_datdebut      [CMR_DATDEBUT+1];
		char   cmr_datfin        [CMR_DATFIN+1];
		char   cmr_test          [CMR_TEST+1];
		char   cmr_plfcode       [CMR_PLFCODE+1];
};
EXEC SQL END DECLARE SECTION;

EXEC SQL endif;

The pre-processor stops at the first char declaration after struct. This can be reproduced in test1.pgc if an EXEC SQL ifndef COMMERCANT;EXEC SQL define COMMERCANT; ...;EXEC SQL endif; is added between the struct declaration.


Sample Code


No file was uploaded with this report


pgsql-bugs by date

Next:From: PeterDate: 2002-02-22 05:44:45
Subject: Trying Cygwin version of PostgreSQL again
Previous:From: Bruce MomjianDate: 2002-02-22 03:56:58
Subject: Re: PostgresSQL 7.1.3 not parsing SELECT portion of SQL correctly

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