Bug #599: ecpg does not parse correctly define and struct in the same file - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #599: ecpg does not parse correctly define and struct in the same file
Date
Msg-id 20020222052302.E33EC475A78@postgresql.org
Whole thread Raw
List pgsql-bugs
BAZIN Nicolas (nbazin@ingenico.com.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
ifndefCOMMERCANT;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:

Previous
From: Bruce Momjian
Date:
Subject: Re: PostgresSQL 7.1.3 not parsing SELECT portion of SQL correctly
Next
From: Bruce Momjian
Date:
Subject: Re: Bug #597: ResultSet.next() throws NullPointerException