Thread: Re: [INTERFACES] PL/Python: How do I use result methods?

Re: [INTERFACES] PL/Python: How do I use result methods?

From
Michael Fuhr
Date:
On Sat, Oct 16, 2004 at 10:56:00AM -0600, Michael Fuhr wrote:

> It looks like nrows(), status(), and fetch() aren't available as
> result object methods.  I don't know what would happen if you
> un-#ifdef-ed that block and the two others that are related;
> perhaps one of the developers can tell us what's going on.
> 
> If the methods aren't available then they probably shouldn't be
> mentioned in the doc.

Any comments on this?  The 8.0.0rc1 PL/Python documentation,
Section 39.3 "Database Access", still mentions the nrows and
status methods, but they don't work.  Here's Oliver's original
message and my followup:

http://archives.postgresql.org/pgsql-interfaces/2004-10/msg00019.php
http://archives.postgresql.org/pgsql-interfaces/2004-10/msg00020.php

I expect it's too late to fix the code for 8.0, so I'm wondering
if the doc should be updated not to mention these methods, or to
mention them but say that they don't work yet.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


Re: [INTERFACES] PL/Python: How do I use result methods?

From
Tom Lane
Date:
Michael Fuhr <mike@fuhr.org> writes:
> Any comments on this?  The 8.0.0rc1 PL/Python documentation,
> Section 39.3 "Database Access", still mentions the nrows and
> status methods, but they don't work.  Here's Oliver's original
> message and my followup:

> http://archives.postgresql.org/pgsql-interfaces/2004-10/msg00019.php
> http://archives.postgresql.org/pgsql-interfaces/2004-10/msg00020.php

> I expect it's too late to fix the code for 8.0, so I'm wondering
> if the doc should be updated not to mention these methods, or to
> mention them but say that they don't work yet.

It looks like someone #ifdef'd out those sections after observing that
the PLy_result_methods table isn't used anyplace.  Perhaps the place
where it should have been used got lost in some earlier patch?

The fetch() method appears to be stubbed out anyhow, so merely
reconnecting the table doesn't look like it would bring that function
into the ranks of working features anyway.  However the other two look
like they might do something useful.

Just out of curiosity, what sort of patch would it take to enable these
functions?  If it's at all nontrivial I'd vote to hold over to 8.1,
but if it's a line or two of code that got lost at some point, it would
seem like a reasonable bug fix ...
        regards, tom lane


Re: [INTERFACES] PL/Python: How do I use result methods?

From
Michael Fuhr
Date:
On Sun, Dec 05, 2004 at 03:15:33PM -0500, Tom Lane wrote:

> It looks like someone #ifdef'd out those sections after observing that
> the PLy_result_methods table isn't used anyplace.  Perhaps the place
> where it should have been used got lost in some earlier patch?

I think the #ifdef's happened in 1.13 (2001/11/16), in case that
brings up any old memories:

http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpython/plpython.c.diff?r1=1.12;r2=1.13

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


Re: [INTERFACES] PL/Python: How do I use result methods?

From
Tom Lane
Date:
I wrote:
> Michael Fuhr <mike@fuhr.org> writes:
>> Any comments on this?  The 8.0.0rc1 PL/Python documentation,
>> Section 39.3 "Database Access", still mentions the nrows and
>> status methods, but they don't work.  Here's Oliver's original
>> message and my followup:

>> http://archives.postgresql.org/pgsql-interfaces/2004-10/msg00019.php
>> http://archives.postgresql.org/pgsql-interfaces/2004-10/msg00020.php

> It looks like someone #ifdef'd out those sections after observing that
> the PLy_result_methods table isn't used anyplace.  Perhaps the place
> where it should have been used got lost in some earlier patch?

> Just out of curiosity, what sort of patch would it take to enable these
> functions?  If it's at all nontrivial I'd vote to hold over to 8.1,
> but if it's a line or two of code that got lost at some point, it would
> seem like a reasonable bug fix ...

Comparing the result and plan method types made it pretty obvious how
those methods are supposed to be hooked up, and it was indeed a
one-liner omission in the original source code.  So I've fixed it.
        regards, tom lane