Re: BUG #13676: C typedef code generated by ecpg with wrong syntax

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Cc: glauciobb(at)hotmail(dot)com
Subject: Re: BUG #13676: C typedef code generated by ecpg with wrong syntax
Date: 2015-10-16 15:33:17
Message-ID: 96336568.NSo5MdvYlz@feivel
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> I trying to migrate my application developed using Pro*c to ECPG. But, when
> I run the code below with "ecpg -c" command to generate c code, the syntax
> for typedef generated appears to be wrong. Below is an sample code and the
> steps to generate error return by C compiler due the wrong syntax for
> typedef.

Thanks for spotting and reporting. The order of the arguments seems to be
broken.

Please try this to fix:
diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer
b/src/interfaces/ecpg/preproc/ecpg.trailer
index 8cc3844..16359a3 100644
--- a/src/interfaces/ecpg/preproc/ecpg.trailer
+++ b/src/interfaces/ecpg/preproc/ecpg.trailer
@@ -1311,7 +1311,7 @@ ECPGTypedef: TYPE_P
if (auto_create_c == false)
$$ = cat_str(7, mm_strdup("/* exec sql type"),
mm_strdup($3), mm_strdup("is"), mm_strdup($5.type_str), mm_strdup($6.str), $7,
mm_strdup("*/"));
else
- $$ = cat_str(6, mm_strdup("typedef "),
mm_strdup($5.type_str), *$7?mm_strdup("*"):mm_strdup(""), mm_strdup($6.str),
mm_strdup($3), mm_strdup(";"));
+ $$ = cat_str(6, mm_strdup("typedef "),
mm_strdup($5.type_str), *$7?mm_strdup("*"):mm_strdup(""), mm_strdup($3),
mm_strdup($6.str), mm_strdup(";"));
}
;

Already committed to HEAD. Will do backports later.

Thanks again.

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.meskes at gmail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message cdaringe 2015-10-16 16:26:19 BUG #13684: pg_restore does not restore indexes when --jobs=X passed
Previous Message kseton 2015-10-16 15:08:26 Issue with database error: ERROR: invalid page header in block 579 of relation base/24067/12574