Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Zo93O-000384-Oq for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Oct 2015 11:56:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Zo93O-0002HR-Bm for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Oct 2015 11:56:38 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zo92l-0001aG-HB for pgsql-bugs@postgresql.org; Mon, 19 Oct 2015 11:55:59 +0000 Received: from snt004-omc3s37.hotmail.com ([65.55.90.176]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zo92i-0001P3-Ex; Mon, 19 Oct 2015 11:55:58 +0000 Received: from SNT149-W3 ([65.55.90.135]) by SNT004-OMC3S37.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Mon, 19 Oct 2015 04:55:55 -0700 X-TMN: [DgQmSTMFEvqj+EBOXuJfWRksyzK6KEHX] X-Originating-Email: [glauciobb@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="_80531dad-fe7e-4987-bb0f-920aa624a34b_" From: =?iso-8859-1?B?R2zhdWNpbyBCYXJyb3MgQmFyY2Vsb3M=?= To: John McKown , Michael Meskes CC: "pgsql-bugs@postgresql.org" Subject: Re: BUG #13676: C typedef code generated by ecpg with wrong syntax Date: Mon, 19 Oct 2015 09:55:55 -0200 Importance: Normal In-Reply-To: References: <20151013192757.2798.91073@wrigleys.postgresql.org>, <96336568.NSo5MdvYlz@feivel>, MIME-Version: 1.0 X-OriginalArrivalTime: 19 Oct 2015 11:55:55.0965 (UTC) FILETIME=[1CAED6D0:01D10A65] X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --_80531dad-fe7e-4987-bb0f-920aa624a34b_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Dear John and Michael=2C=20 Thanks for your help. Everything is working now. Regards=2CGl=E1ucio Barros Barcelos Date: Fri=2C 16 Oct 2015 13:09:34 -0500 Subject: Re: [BUGS] BUG #13676: C typedef code generated by ecpg with wrong= syntax From: john.archie.mckown@gmail.com To: meskes@postgresql.org CC: pgsql-bugs@postgresql.org=3B glauciobb@hotmail.com I did a "git pull" from the PostrgeSQL repository. then did a "make ecpg" i= n the src/interfaces/ecpg directory. I then used the new ecpg on the exampl= e code=2C followed by a gcc compile. The compile went fine. I made a slight= change to the code=2C just because to be: #include EXEC SQL TYPE t_char_10 IS char[10]=3BEXEC SQL TYPE t_ch= ar_10d IS struct { char data[10]=3B}=3BEXEC SQL TYPE char_ptr IS char refe= rence=3Bint main(){ t_char_10 string10=3B int len=3Dsizeof string10= =3B printf("size is: %d\n"=2Clen)=3B int status =3D 0=3B return st= atus=3B} And then: ecpg -c test-ecpg.pgc && gcc test-ecpg.c && ./a.out which printed: size is 10 Looks good to me on Linux=2C Fedora 22 x86_64. On Fri=2C Oct 16=2C 2015 at 10:33 AM=2C Michael Meskes wrote: > I trying to migrate my application developed using Pro*c to ECPG. But=2C = when =0A= > I run the code below with "ecpg -c" command to generate c code=2C the syn= tax =0A= > for typedef generated appears to be wrong. Below is an sample code and th= e =0A= > steps to generate error return by C compiler due the wrong syntax for =0A= > typedef. =0A= =0A= Thanks for spotting and reporting. The order of the arguments seems to be =0A= broken. =0A= =0A= Please try this to fix: =0A= diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer =0A= b/src/interfaces/ecpg/preproc/ecpg.trailer =0A= index 8cc3844..16359a3 100644 =0A= --- a/src/interfaces/ecpg/preproc/ecpg.trailer =0A= +++ b/src/interfaces/ecpg/preproc/ecpg.trailer =0A= @@ -1311=2C7 +1311=2C7 @@ ECPGTypedef: TYPE_P =0A= if (auto_create_c =3D=3D false) =0A= $$ =3D cat_str(7=2C mm_strdup("/* exec sql = type")=2C =0A= mm_strdup($3)=2C mm_strdup("is")=2C mm_strdup($5.type_str)=2C mm_strdup($6.= str)=2C $7=2C =0A= mm_strdup("*/"))=3B =0A= else =0A= - $$ =3D cat_str(6=2C mm_strdup("typedef ")= =2C =0A= mm_strdup($5.type_str)=2C *$7?mm_strdup("*"):mm_strdup("")=2C mm_strdup($6.= str)=2C =0A= mm_strdup($3)=2C mm_strdup("=3B"))=3B =0A= + $$ =3D cat_str(6=2C mm_strdup("typedef ")= =2C =0A= mm_strdup($5.type_str)=2C *$7?mm_strdup("*"):mm_strdup("")=2C mm_strdup($3)= =2C =0A= mm_strdup($6.str)=2C mm_strdup("=3B"))=3B =0A= } =0A= =3B =0A= =0A= Already committed to HEAD. Will do backports later. =0A= =0A= Thanks again. =0A= =0A= Michael =0A= -- =0A= Michael Meskes =0A= Michael at Fam-Meskes dot De=2C Michael at Meskes dot (De|Com|Net|Org) =0A= Meskes at (Debian|Postgresql) dot Org =0A= Jabber: michael.meskes at gmail dot com =0A= VfL Borussia! For=E7a Bar=E7a! Go SF 49ers! Use Debian GNU/Linux=2C Postgre= SQL =0A= =0A= =0A= =0A= -- =0A= Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) =0A= To make changes to your subscription: =0A= http://www.postgresql.org/mailpref/pgsql-bugs =0A= --=20 Schrodinger's backup: The condition of any backup is unknown until a restor= e is attempted. Yoda of Borg=2C we are. Futile=2C resistance is=2C yes. Assimilated=2C you = will be. He's about as useful as a wax frying pan. 10 to the 12th power microphones =3D 1 Megaphone Maranatha! <>< John McKown=0A= = --_80531dad-fe7e-4987-bb0f-920aa624a34b_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Dear John and Michael= =2C =3B

Thanks for your help.  =3BEverythi= ng is working now.

Regards=2C
Gl=E1ucio = Barros Barcelos



Date: = Fri=2C 16 Oct 2015 13:09:34 -0500
Subject: Re: [BUGS] BUG #13676: C type= def code generated by ecpg with wrong syntax
From: john.archie.mckown@gm= ail.com
To: meskes@postgresql.org
CC: pgsql-bugs@postgresql.org=3B gl= auciobb@hotmail.com

I did a "git pull"= from the PostrgeSQL repository. then did a "make ecpg" in the src/interfac= es/ecpg directory. I then used the new ecpg on the example code=2C followed= by a gcc compile. The compile went fine. I made a slight change to the cod= e=2C just because to be:

#include <=3Bstdio.h= >=3B
EXEC SQL TYPE t_char_10  = =3BIS char[10]=3B
EXEC SQL TYPE t_char= _10d  =3BIS struct { char data[10]=3B}=3B
EXEC SQL TYPE char_ptr IS char reference=3B
int main()
{
 =3B  =3B t_char_10 string10=3B
 =3B  =3B int len=3Dsizeof string10=3B<= /div>
 =3B  =3B printf("size is: %d\= n"=2Clen)=3B
 =3B  =3B int sta= tus =3D 0=3B
 =3B  =3B return = status=3B
}

And then:

ecpg -c = test-ecpg.pgc &=3B&=3B gcc test-ecpg.c &=3B&=3B ./a.out

whi= ch printed:

size is 10

<= div class=3D"ecxgmail_default">Looks good to me on Linux=2C Fedora 22 x86_6= 4.

On Fri=2C Oct 16=2C 2015 at 10:33 AM=2C Michael Meskes <=3Bm= eskes@postgresql.org>=3B wrote:
= >=3B I trying to migrate my application developed using Pro*c to ECPG. Bu= t=2C when
=0A= >=3B I run the code below with "ecpg -c" command to generate c code=2C th= e syntax
=0A= >=3B for typedef generated appears to be wrong. Below is an sample code a= nd the
=0A= >=3B steps to generate error return by C compiler due the wrong syntax fo= r
=0A= >=3B typedef.
=0A=
=0A=
Thanks for spotting and reporting. The order of the arguments seems = to be
=0A= broken.
=0A=
=0A= Please try this to fix:
=0A= diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer
=0A= b/src/interfaces/ecpg/preproc/ecpg.trailer
=0A= index 8cc3844..16359a3 100644
=0A= --- a/src/interfaces/ecpg/preproc/ecpg.trailer
=0A= +++ b/src/interfaces/ecpg/preproc/ecpg.trailer
=0A= @@ -1311=2C7 +1311=2C7 @@ ECPGTypedef: TYPE_P
=0A=  =3B  =3B  =3B  =3B  =3B  =3B  =3B  =3B &nb= sp=3B  =3B  =3B  =3B if (auto_create_c =3D=3D false)
=0A=  =3B  =3B  =3B  =3B  =3B  =3B  =3B  =3B &nb= sp=3B  =3B  =3B  =3B  =3B  =3B  =3B  =3B $$ =3D= cat_str(7=2C mm_strdup("/* exec sql type")=2C
=0A= mm_strdup($3)=2C mm_strdup("is")=2C mm_strdup($5.type_str)=2C mm_strdup($6.= str)=2C $7=2C
=0A= mm_strdup("*/"))=3B
=0A=  =3B  =3B  =3B  =3B  =3B  =3B  =3B  =3B &nb= sp=3B  =3B  =3B  =3B else
=0A= - =3B  =3B  =3B  =3B  =3B  =3B  =3B  =3B &n= bsp=3B  =3B  =3B  =3B  =3B  =3B  =3B  =3B$$ =3D= cat_str(6=2C mm_strdup("typedef ")=2C
=0A= mm_strdup($5.type_str)=2C *$7?mm_strdup("*"):mm_strdup("")=2C mm_strdup($6.= str)=2C
=0A= mm_strdup($3)=2C mm_strdup("=3B"))=3B
=0A= + =3B  =3B  =3B  =3B  =3B  =3B  =3B  =3B &n= bsp=3B  =3B  =3B  =3B  =3B  =3B  =3B  =3B$$ =3D= cat_str(6=2C mm_strdup("typedef ")=2C
=0A= mm_strdup($5.type_str)=2C *$7?mm_strdup("*"):mm_strdup("")=2C mm_strdup($3)= =2C
=0A= mm_strdup($6.str)=2C mm_strdup("=3B"))=3B
=0A=  =3B  =3B  =3B  =3B  =3B  =3B  =3B  =3B }=0A=  =3B  =3B  =3B  =3B  =3B  =3B  =3B  =3B =3B=
=0A=
=0A= Already committed to HEAD. Will do backports later.
=0A=
=0A= Thanks again.
=0A=
=0A= Michael
=0A= --
=0A= Michael Meskes
=0A= Michael at Fam-Meskes dot De=2C Michael at Meskes dot (De|Com|Net|Org)
= =0A= Meskes at (Debian|Postgresql) dot Org
=0A= Jabber: michael.meskes at gmail dot com
=0A= VfL Borussia! For=E7a Bar=E7a! Go SF 49ers! Use Debian GNU/Linux=2C Postgre= SQL
=0A=

=0A=
=0A=
=0A= --
=0A= Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
=0A= To make changes to your subscription:
=0A= http://www.postgresql.org/mailpref/pgsql-bugs
= =0A=



--
=

= Schrodinger's backup: The condition of any backup is unknown until a restor= e is attempted.

Yoda of Borg=2C we are. Futile=2C = resistance is=2C yes. Assimilated=2C you will be.

He's about as useful as a wax frying pan.

10 = to the 12th power microphones =3D 1 Megaphone

Maranatha! <=3B>= =3B<=3B
John McKown
=0A=
= --_80531dad-fe7e-4987-bb0f-920aa624a34b_--