Re: Is this a bug in ECPG?

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: "Wang, Jing" <jingw(at)fast(dot)au(dot)fujitsu(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, "Arulappan, Arul Shaji" <arul(at)fast(dot)au(dot)fujitsu(dot)com>, "Boguk, Maksym" <maksymb(at)fast(dot)au(dot)fujitsu(dot)com>
Subject: Re: Is this a bug in ECPG?
Date: 2013-09-07 19:09:58
Message-ID: 522B7A06.8080200@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2013-09-06 09:57 keltezéssel, Boszormenyi Zoltan írta:
> 2013-09-06 02:57 keltezéssel, Wang, Jing írta:
>>
>> Hi,
>>
>> ECPG don't support the following scenario:
>>
>> char cur_name = "cur1";
>>
>> EXEC SQL DECLARE :cur_name CURSOR FOR ...
>>
>> EXEC SQL OPEN :cur_name;
>>
>> EXEC SQL FETCH cur1 INTO...
>>
>> ...
>>
>> EXEC SQL CLOSE :cur_name;
>>
>> An compile error will occur for above codes because ECPG can't find the "cur1".
>>
>
> Of course it cannot find it, ECPG doesn't interpret the content of the variable,
> so it cannot know it is "cur1".
>
>> But it does support the following scenario:
>>
>> char cur_name = "cur1";
>>
>> EXEC SQL DECLARE :cur_name CURSOR FOR ...
>>
>> EXEC SQL OPEN :cur_name;
>>
>> EXEC SQL FETCH :cur_name INTO...
>>
>> ...
>>
>> EXEC SQL CLOSE cur1;
>>
>> Does the second scenario is a bug for ECPG?
>>
>
> Actually, it looks like it is a bug.

BTW, my "ECPG cursor readahead" patch unintentionally fixed this.
https://commitfest.postgresql.org/action/patch_view?id=1195

>
>> Will anyone use the second scenario to close an CURSOR that is named by a variable?
>>
>
> Not very likely.
>
>> Kind regards,
>>
>> Jing
>>
>
>
> --
> ----------------------------------
> Zoltán Böszörményi
> Cybertec Schönig & Schönig GmbH
> Gröhrmühlgasse 26
> A-2700 Wiener Neustadt, Austria
> Web:http://www.postgresql-support.de
> http://www.postgresql.at/

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Atkins 2013-09-07 21:47:45 Re: Constraint exclusion and overlapping range checks
Previous Message Tom Lane 2013-09-07 14:27:02 Re: Hash Support Function