ecpg: the comments inside the declare section are not outputted correctly. - Mailing list pgsql-interfaces

From Ashutosh Sharma
Subject ecpg: the comments inside the declare section are not outputted correctly.
Date
Msg-id CAE9k0Pm-N4eFidk9Mg_ZhdLzGhPRth4K+Zgaigo44EsLX276Jg@mail.gmail.com
Whole thread Raw
List pgsql-interfaces
Hi All,

While working on some other issue, I noticed that the comments inside the declare section are not outputted correctly. Have a look at the below example and its output.

void main(void)
{
exec sql begin declare section;
    int v1 = 100;
/* First Layer */
#ifdef MACRO1
/* Second Layer */
#ifdef MACRO2
   int testVar = 2;
#endif
#endif
exec sql end declare section;

    return 1;
}

Output:

void main(void)
{
/* exec sql begin declare section */

/* First Layer *//* Second Layer */
#line 4 "test.pgc"
 int v1 = 100 ;

#ifdef MACRO1

#ifdef MACRO2

#line 9 "test.pgc"
 int testVar = 2 ;

#endif
 #endif
/* exec sql end declare section */
#line 12 "test.pgc"


    return 1;
}

If you see the output, the comments present inside the input file got shifted to the wrong place in the output file. This doesn't happen if such comments are present outside the declare section.

I know this is not a severe issue but certainly something that would be nice correcting.

Thanks,

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

pgsql-interfaces by date:

Previous
From: Tom Lane
Date:
Subject: Re: ecpg: issue related to preprocessor directives
Next
From: Ashutosh Sharma
Date:
Subject: #include present twice in define.pgc