Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Concern about new PL/Perl

3 views
Skip to first unread message

Peter Eisentraut

unread,
Nov 6, 2004, 8:35:23 AM11/6/04
to
It seems that in the new PL/Perl, the result of the spi_exec_query
function changes in meaning depending on the command. For a SELECT,
the value of

$res->{rows}

is a reference to an array of the result rows.

For a different command

$res->{rows}

is a scalar containing the number of affected rows. I think this is a
poor design. Couldn't we have a different result field that always
contains the number of rows?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Andrew Dunstan

unread,
Nov 15, 2004, 7:35:16 AM11/15/04
to

Peter Eisentraut wrote:

>It seems that in the new PL/Perl, the result of the spi_exec_query
>function changes in meaning depending on the command. For a SELECT,
>the value of
>
>$res->{rows}
>
>is a reference to an array of the result rows.
>
>For a different command
>
>$res->{rows}
>
>is a scalar containing the number of affected rows. I think this is a
>poor design. Couldn't we have a different result field that always
>contains the number of rows?
>
>

I don't recall seeing any reply to this, but I'm inclined to agree with it.

Joshua, any comment from CP?

cheers

andrew

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majo...@postgresql.org so that your
message can get through to the mailing list cleanly

Peter Eisentraut

unread,
Nov 16, 2004, 5:34:14 PM11/16/04
to
Andrew Dunstan wrote:
> >$res->{rows}
> >
> >is a reference to an array of the result rows.
> >
> >For a different command
> >
> >$res->{rows}
> >
> >is a scalar containing the number of affected rows.

> I don't recall seeing any reply to this, but I'm inclined to agree


> with it.
>
> Joshua, any comment from CP?

I think using "nrows" for the number of rows would be somewhat
consistent with the other PLs.


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

0 new messages