Hi,

I'm not sure it's a bug or it's normal, so i don't send it to pgsq-bugs.

Well, i have written pgbench in PRO*C to have a common pgbench.pgc
source for Postgres and Oracle.
However, there are some differences between the Postgres Pro*c and
Oracle Pro*c.

So, i use #ifdef ORACLE  #else  #endif preprocessing instructions to
differentiate PG from Oracle Pro*c syntaxes.

This works fine with Oracle Pro*c but EGPG tries to translate the code
into #ifdef ORACLE #endif blocks and FAILS with the message : "ERROR :
INVALID DATA TYPE ...".
That means cpp is not called by ECPG but is more or less called by PROC
ORACLE.

For example, this following code : test.pgc

#include <stdlib.h>

main()
{
printf("Before define\n");
#ifdef ORACLE
sql_context ctx;
EXEC SQL CONTEXT USE :ctx;
EXEC SQL CONNECT "scott/tiger";
#else
EXEC SQL CONNECT TO template1 as "cnx_init";
#endif
printf("After endif\n");
}

ecpg -o test.c test.pgc
returns :
test.pgc:8: INVALID DATA TYPE 'CONTEXT'

But by doing the following commands :
cpp -E -o testE.pgc test.pgc
ecpg -o test.c testE.pgc

is OK.

So, is there an other solutions to share EXEC SQL instructions between
Postgres and Oracle ?

Best regards,
    Thierry.

begin:vcard 
n:Missimilly;Thierry
tel;fax:+33 (0)4 76 29 78 78
tel;work:+33 (0)4 76 29 74 54
x-mozilla-html:FALSE
url:http:\\www.bull.com
org:BIS/R&D
adr:;;Bull SA, 1, rue de provence - BP 208;ECHIROLLES;;38432;FRANCE
version:2.1
email;internet:[EMAIL PROTECTED]
x-mozilla-cpt:;-18184
fn:Thierry Missimilly
end:vcard
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to