ecpg: the comments inside the declare section are not outputted correctly.

From: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: ecpg: the comments inside the declare section are not outputted correctly.
Date: 2020-08-31 12:53:51
Message-ID: CAE9k0Pm-N4eFidk9Mg_ZhdLzGhPRth4K+Zgaigo44EsLX276Jg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-interfaces by date

  From Date Subject
Next Message Ashutosh Sharma 2020-09-07 13:47:58 #include <stdlib.h> present twice in define.pgc
Previous Message Tom Lane 2020-08-03 13:46:54 Re: ecpg: issue related to preprocessor directives