pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #14167: ecpg parser cann't ignore code in #ifdef ?
4+ messages / 4 participants
[nested] [flat]
* BUG #14167: ecpg parser cann't ignore code in #ifdef ?
@ 2016-06-01 03:33 digoal@126.com
2016-06-01 13:43 ` Re: BUG #14167: ecpg parser cann't ignore code in #ifdef ? Michael Meskes <meskes@postgresql.org>
0 siblings, 1 reply; 4+ messages in thread
From: digoal@126.com @ 2016-06-01 03:33 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 14167
Logged by: Zhou Digoal
Email address: digoal@126.com
PostgreSQL version: 9.6beta1
Operating system: CentOS 6.x x64
Description:
HI,
this is my pgc code.
#include <stdio.h>
#include <stdlib.h>
#include <pgtypes_numeric.h>;
EXEC SQL WHENEVER SQLERROR STOP;
int
main(void)
{
EXEC SQL BEGIN DECLARE SECTION;
numeric *num;
#ifdef ABC
err *abc;
#endif
numeric *num2;
decimal *dec;
EXEC SQL END DECLARE SECTION;
EXEC SQL CONNECT TO tcp:postgresql://127.0.0.1:5432/postgres AS test
USER test USING test;
num = PGTYPESnumeric_new();
dec = PGTYPESdecimal_new();
EXEC SQL SELECT 12.345::numeric(4,2), 23.456::decimal(4,2) INTO :num,
:dec;
printf("numeric = %s\n", PGTYPESnumeric_to_asc(num, 0));
printf("numeric = %s\n", PGTYPESnumeric_to_asc(num, 1));
printf("numeric = %s\n", PGTYPESnumeric_to_asc(num, 2));
/* Convert decimal to numeric to show a decimal value. */
num2 = PGTYPESnumeric_new();
PGTYPESnumeric_from_decimal(dec, num2);
printf("decimal = %s\n", PGTYPESnumeric_to_asc(num2, 0));
printf("decimal = %s\n", PGTYPESnumeric_to_asc(num2, 1));
printf("decimal = %s\n", PGTYPESnumeric_to_asc(num2, 2));
PGTYPESnumeric_free(num2);
PGTYPESdecimal_free(dec);
PGTYPESnumeric_free(num);
EXEC SQL COMMIT;
EXEC SQL DISCONNECT ALL;
return 0;
}
this is ERROR
ecpg -t -c -I/home/digoal/pgsql9.6/include -o t.c t.pgc
t.pgc:15: ERROR: unrecognized data type name "err"
And use #ifndef and -DABC also error.
ECPG parser cann't skip code in #ifdef or #ifndef ?
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #14167: ecpg parser cann't ignore code in #ifdef ?
2016-06-01 03:33 BUG #14167: ecpg parser cann't ignore code in #ifdef ? digoal@126.com
@ 2016-06-01 13:43 ` Michael Meskes <meskes@postgresql.org>
2016-06-02 01:04 ` Re: BUG #14167: ecpg parser cann't ignore code in #ifdef ? 德哥 <digoal@126.com>
0 siblings, 1 reply; 4+ messages in thread
From: Michael Meskes @ 2016-06-01 13:43 UTC (permalink / raw)
To: pgsql-bugs; +Cc: digoal@126.com
> this is my pgc code.
> ...
> #ifdef ABC
> err *abc;
> #endif
> ...
> this is ERROR
> ecpg -t -c -I/home/digoal/pgsql9.6/include -o t.c t.pgc
> t.pgc:15: ERROR: unrecognized data type name "err"
>
> And use #ifndef and -DABC also error.
> ECPG parser cann't skip code in #ifdef or #ifndef ?
'#ifdef' is a C precompiler command and thus is only parsed by cpp et
al. If you want ecpg to parse it you have to use 'exec sql ifdef'
instead.
Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! SF 49ers! Use Debian GNU/Linux, PostgreSQL
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #14167: ecpg parser cann't ignore code in #ifdef ?
2016-06-01 03:33 BUG #14167: ecpg parser cann't ignore code in #ifdef ? digoal@126.com
2016-06-01 13:43 ` Re: BUG #14167: ecpg parser cann't ignore code in #ifdef ? Michael Meskes <meskes@postgresql.org>
@ 2016-06-02 01:04 ` 德哥 <digoal@126.com>
2016-06-02 01:59 ` Re: BUG #14167: ecpg parser cann't ignore code in #ifdef ? Michael Paquier <michael.paquier@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: 德哥 @ 2016-06-02 01:04 UTC (permalink / raw)
To: Michael Meskes <meskes@postgresql.org>; +Cc: pgsql-bugs
HI,
Thanks very much,
Because I see EDB's document ECPGplus can parser #ifdef.
so why postgresql community not do that?
I think many PG user need it to adpate some enviroment (like Oracle , pg, db2, ...) in .pgc code.
best regards ,
digoal
--
公益是一辈子的事,I'm Digoal,Just Do It.
At 2016-06-01 21:43:00, "Michael Meskes" <meskes@postgresql.org> wrote:
>> this is my pgc code.
>> ...
>> #ifdef ABC
>> err *abc;
>> #endif
>> ...
>> this is ERROR
>> ecpg -t -c -I/home/digoal/pgsql9.6/include -o t.c t.pgc
>> t.pgc:15: ERROR: unrecognized data type name "err"
>>
>> And use #ifndef and -DABC also error.
>> ECPG parser cann't skip code in #ifdef or #ifndef ?
>
>'#ifdef' is a C precompiler command and thus is only parsed by cpp et
>al. If you want ecpg to parse it you have to use 'exec sql ifdef'
>instead.
>
>Michael
>--
>Michael Meskes
>Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
>Meskes at (Debian|Postgresql) dot Org
>Jabber: michael at xmpp dot meskes dot org
>VfL Borussia! Força Barça! SF 49ers! Use Debian GNU/Linux, PostgreSQL
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #14167: ecpg parser cann't ignore code in #ifdef ?
2016-06-01 03:33 BUG #14167: ecpg parser cann't ignore code in #ifdef ? digoal@126.com
2016-06-01 13:43 ` Re: BUG #14167: ecpg parser cann't ignore code in #ifdef ? Michael Meskes <meskes@postgresql.org>
2016-06-02 01:04 ` Re: BUG #14167: ecpg parser cann't ignore code in #ifdef ? 德哥 <digoal@126.com>
@ 2016-06-02 01:59 ` Michael Paquier <michael.paquier@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: Michael Paquier @ 2016-06-02 01:59 UTC (permalink / raw)
To: 德哥 <digoal@126.com>; +Cc: Michael Meskes <meskes@postgresql.org>; pgsql-bugs
On Thu, Jun 2, 2016 at 10:04 AM, 德哥 <digoal@126.com> wrote:
> Because I see EDB's document ECPGplus can parser #ifdef.
> so why postgresql community not do that?
Because EDB's stuff is not community stuff. I am not sure you can
expect both things to match, and it is not like ifdef grammar is not
supported as already mentioned by Michael.
--
Michael
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2016-06-02 01:59 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-06-01 03:33 BUG #14167: ecpg parser cann't ignore code in #ifdef ? digoal@126.com
2016-06-01 13:43 ` Michael Meskes <meskes@postgresql.org>
2016-06-02 01:04 ` 德哥 <digoal@126.com>
2016-06-02 01:59 ` Michael Paquier <michael.paquier@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox