Re: BUG #13676: C typedef code generated by ecpg with wrong syntax - Mailing list pgsql-bugs

From Michael Meskes
Subject Re: BUG #13676: C typedef code generated by ecpg with wrong syntax
Date
Msg-id 96336568.NSo5MdvYlz@feivel
Whole thread Raw
In response to BUG #13676: C typedef code generated by ecpg with wrong syntax  (glauciobb@hotmail.com)
Responses Re: BUG #13676: C typedef code generated by ecpg with wrong syntax  (John McKown <john.archie.mckown@gmail.com>)
List 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 s=
yntax
> for typedef generated appears to be wrong. Below is an sample code an=
d 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=20
broken.

Please try this to fix:
diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer=20
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 =3D=3D false)
                                $$ =3D cat_str(7, mm_strdup("/* exec sq=
l type"),=20
mm_strdup($3), mm_strdup("is"), mm_strdup($5.type_str), mm_strdup($6.st=
r), $7,=20
mm_strdup("*/"));
                        else
-                               $$ =3D cat_str(6, mm_strdup("typedef ")=
,=20
mm_strdup($5.type_str), *$7?mm_strdup("*"):mm_strdup(""), mm_strdup($6.=
str),=20
mm_strdup($3), mm_strdup(";"));
+                               $$ =3D cat_str(6, mm_strdup("typedef ")=
,=20
mm_strdup($5.type_str), *$7?mm_strdup("*"):mm_strdup(""), mm_strdup($3)=
,=20
mm_strdup($6.str), mm_strdup(";"));
                }
                ;

Already committed to HEAD. Will do backports later.

Thanks again.

Michael
--=20
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=E7a Bar=E7a! Go SF 49ers! Use Debian GNU/Linux, Postg=
reSQL

pgsql-bugs by date:

Previous
From: kseton@noblesys.com
Date:
Subject: Issue with database error: ERROR: invalid page header in block 579 of relation base/24067/12574
Next
From: John R Pierce
Date:
Subject: Re: Issue with database error: ERROR: invalid page header in block 579 of relation base/24067/12574