Lists: | pgsql-bugs |
---|
From: | "Ahmed Shinwari" <ahmed(dot)shibwari(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | ECPG Preprocessor throws Syntax Error [Devel Repository] |
Date: | 2008-12-11 17:09:40 |
Message-ID: | e31749290812110909k652328d3n81b9149ee2bbec75@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
Hi,
Yesterday I pull source from PG-Devel repository (Head) and was playing
around with ECPG. I got following two issues while parsing my script files
through ECPG preprocessor which I think are potential bugs;
1- I get this error message from preprocessor,
*ERROR: cursor "m_name_cursor" already defined *
Below is the code snippet, error message is thrown on the last line of this
snippet;
...
...
EXEC SQL DECLARE m_name_cursor CURSOR FOR SELECT name,id FROM m_table3;
EXEC SQL OPEN m_name_cursor;
EXEC SQL CLOSE m_name_cursor;
/* Declaring cursor with the same name */
EXEC SQL DECLARE m_name_cursor CURSOR FOR SELECT name,id FROM m_table4;
2- Preprocessor throws this error;
*ERROR: syntax error at or near "-"*
Below is the code snippet, the error is thrown on the last line of the
snippet;
...
...
const char *stmt1 = "SELECT abs(?)";
EXEC SQL PREPARE mystmt1 FROM :stmt1;
EXEC SQL EXECUTE mystmt1 INTO :result USING -.55566;
Regards,
Ahmed
From: | Michael Meskes <meskes(at)postgresql(dot)org> |
---|---|
To: | Ahmed Shinwari <ahmed(dot)shibwari(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: ECPG Preprocessor throws Syntax Error [Devel Repository] |
Date: | 2008-12-12 12:26:22 |
Message-ID: | 20081212122622.GA8289@feivel.credativ.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
On Thu, Dec 11, 2008 at 10:09:40PM +0500, Ahmed Shinwari wrote:
> through ECPG preprocessor which I think are potential bugs;
>
> 1- I get this error message from preprocessor,
>
> *ERROR: cursor "m_name_cursor" already defined *
>
> Below is the code snippet, error message is thrown on the last line of this
> snippet;
>
> EXEC SQL DECLARE m_name_cursor CURSOR FOR SELECT name,id FROM m_table3;
> EXEC SQL OPEN m_name_cursor;
> EXEC SQL CLOSE m_name_cursor;
>
> /* Declaring cursor with the same name */
> EXEC SQL DECLARE m_name_cursor CURSOR FOR SELECT name,id FROM m_table4;
I might be missing something here, but where do you see the bug? The cursor is
indeed already defined.
> 2- Preprocessor throws this error;
>
> *ERROR: syntax error at or near "-"*
> ...
Fixed in CVS. Thanks for the report.
Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes(at)jabber(dot)org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!
From: | Zahid Khan <khanzahid235(at)yahoo(dot)com> |
---|---|
To: | Ahmed Shinwari <ahmed(dot)shibwari(at)gmail(dot)com>, Michael Meskes <meskes(at)postgresql(dot)org> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: ECPG Preprocessor throws Syntax Error [Devel Repository] |
Date: | 2008-12-12 15:06:31 |
Message-ID: | 216424.58053.qm@web54502.mail.re2.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
>I might be missing something here, but where do you see the bug? The cursor is
>indeed already defined.
What i understand here is,we should be able to DECLARE cursor again
with the same name if that is CLOSE already.
--- On Fri, 12/12/08, Michael Meskes <meskes(at)postgresql(dot)org> wrote:
From: Michael Meskes <meskes(at)postgresql(dot)org>
Subject: Re: [BUGS] ECPG Preprocessor throws Syntax Error [Devel Repository]
To: "Ahmed Shinwari" <ahmed(dot)shibwari(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Date: Friday, December 12, 2008, 4:26 AM
On Thu, Dec 11, 2008 at 10:09:40PM +0500, Ahmed Shinwari wrote:
> through ECPG preprocessor which I think are potential bugs;
>
> 1- I get this error message from preprocessor,
>
> *ERROR: cursor "m_name_cursor" already defined *
>
> Below is the code snippet, error message is thrown on the last line of
this
> snippet;
>
> EXEC SQL DECLARE m_name_cursor CURSOR FOR SELECT name,id FROM m_table3;
> EXEC SQL OPEN m_name_cursor;
> EXEC SQL CLOSE m_name_cursor;
>
> /* Declaring cursor with the same name */
> EXEC SQL DECLARE m_name_cursor CURSOR FOR SELECT name,id FROM m_table4;
I might be missing something here, but where do you see the bug? The cursor is
indeed already defined.
> 2- Preprocessor throws this error;
>
> *ERROR: syntax error at or near "-"*
> ...
Fixed in CVS. Thanks for the report.
Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes(at)jabber(dot)org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | khanzahid235(at)yahoo(dot)com |
Cc: | Ahmed Shinwari <ahmed(dot)shibwari(at)gmail(dot)com>, Michael Meskes <meskes(at)postgresql(dot)org>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: ECPG Preprocessor throws Syntax Error [Devel Repository] |
Date: | 2008-12-12 15:37:35 |
Message-ID: | 6192.1229096255@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
Zahid Khan <khanzahid235(at)yahoo(dot)com> writes:
>> I might be missing something here, but where do you see the bug? The cursor is
>> indeed already defined.
> What i understand here is,we should be able to DECLARE cursor again
> with the same name if that is CLOSE already.
No, CLOSE reverses the effect of OPEN, not of DECLARE.
regards, tom lane