Обсуждение: BUG #3706: ecpg regression: "MOVE FORWARD"

Поиск
Список
Период
Сортировка

BUG #3706: ecpg regression: "MOVE FORWARD"

От
"Scott Bailey"
Дата:
The following bug has been logged online:

Bug reference:      3706
Logged by:          Scott Bailey
Email address:      scott.bailey@eds.com
PostgreSQL version: 8.3beta1
Operating system:   Tru64
Description:        ecpg regression: "MOVE FORWARD"
Details:

The following statement:

exec sql MOVE FORWARD :RowMove IN Sniffer;

which worked correctly in 8.2.4 and previous versions, now fails to compile
in 8.3beta1; I receive the following error message:

ERROR: fetch/move count must not be a variable.

This sucks and I couldn't find anything about it in the TODO list or Release
Notes. Is this unintentional, or should I be recoding my program to use a
loop to move forward 1 row at a time?

Re: BUG #3706: ecpg regression: "MOVE FORWARD"

От
"Bailey, Scott"
Дата:
I haven't seen any feedback on this report, but FYI... I worked around
this problem by rewriting my code to use a dynamic prepared statement
instead, e.g.

OLD:

EXEC SQL MOVE FORWARD :RowMove IN Sniffer;

NEW:

const char mover[] =3D "MOVE FORWARD ? IN Sniffer";
[...]
EXEC SQL PREPARE MoverSQL FROM :mover;
[...]
EXEC SQL EXECUTE MoverSQL USING :RowMove;
[...]
EXEC SQL DEALLOCATE PREPARE MoverSQL;

Assuming the new restriction on the original "MOVE FORWARD" is
intentional, it would be nice to see a warning that code changes are
required get into the documentation.

Thanks,
Scott

-----Original Message-----
From: pgsql-bugs-owner@postgresql.org
[mailto:pgsql-bugs-owner@postgresql.org] On Behalf Of Scott Bailey
Sent: Monday, October 29, 2007 11:45 AM
To: pgsql-bugs@postgresql.org
Subject: [BUGS] BUG #3706: ecpg regression: "MOVE FORWARD"


The following bug has been logged online:

Bug reference:      3706
Logged by:          Scott Bailey
Email address:      scott.bailey@eds.com
PostgreSQL version: 8.3beta1
Operating system:   Tru64
Description:        ecpg regression: "MOVE FORWARD"
Details:=20

The following statement:

exec sql MOVE FORWARD :RowMove IN Sniffer;

which worked correctly in 8.2.4 and previous versions, now fails to
compile
in 8.3beta1; I receive the following error message:

ERROR: fetch/move count must not be a variable.

This sucks and I couldn't find anything about it in the TODO list or
Release
Notes. Is this unintentional, or should I be recoding my program to use
a
loop to move forward 1 row at a time?

Re: BUG #3706: ecpg regression: "MOVE FORWARD"

От
Michael Meskes
Дата:
[Sorry for the late reply, but I've been on two business trips last week
without internet access.]

> The following statement:
>
> exec sql MOVE FORWARD :RowMove IN Sniffer;
>
> which worked correctly in 8.2.4 and previous versions, now fails to compile
> in 8.3beta1; I receive the following error message:
>
> ERROR: fetch/move count must not be a variable.
>
> This sucks and I couldn't find anything about it in the TODO list or Release
> Notes. Is this unintentional, or should I be recoding my program to use a
> loop to move forward 1 row at a time?

I'm not sure whether this has been a documented feature at all, but yes,
it got removed during the rewrite because the backend doesn't accept a
variable in this position. Also I vaguely remember not finding this
feature in the standard.

The standard way of doing this kind of statement is to write the whole
statement into a string and then "execute immediate" it. However, I'd be
willing to put this back in but fail to see how atm. The problem is that
the statement is created as a string that then gets send to the backend.
As I said putting a variable in here isn't allowed on the backend side.
Older versions of ecpg created the statement by replacing the variables
on the client side, so this didn't matter at all.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!