Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
David Fetter <[EMAIL PROTECTED]> writes: >> So it's a case of bad documentation, which we will fix very shortly. Sorry >> for the noise. > Please find attached a patch that fixes this. Applied, thanks. regards, tom lane ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
On Fri, Nov 19, 2004 at 05:29:20AM -0600, Andrew Dunstan wrote: > Tom Lane said: > > Josh Berkus <[EMAIL PROTECTED]> writes: > >>> I would agree that seems a little odd ;). Would this be something we > >>> want done for 8.0? > > > >> I think we'd better. Otherwise, people will get used to the broken > >> syntax. > > > > Agreed. Someone's going to step up and patch this, no? > > > > (Not me --- I've already wasted more hours than I could afford this > > week on plperl.) > > > > I knew I should have looked at this closer when Peter made his complaint - > it sounded familiar. IIRC it was actually a point I raised about the > original code, and it was fixed. At any rate, last night Abhijit Menon-Sen > and I looked at the code and got confused becuse it appears to have been > fixed ;-). "rows" only contains data and only exists if the result is from a > successful select. "processed" is the row count, and is always present. > > So it's a case of bad documentation, which we will fix very shortly. Sorry > for the noise. Please find attached a patch that fixes this. Cheers, D -- David Fetter [EMAIL PROTECTED] http://fetter.org/ phone: +1 510 893 6100 mobile: +1 415 235 3778 Remember to vote! Index: doc/src/sgml/plperl.sgml === RCS file: /projects/cvsroot/pgsql/doc/src/sgml/plperl.sgml,v retrieving revision 2.30 diff -c -r2.30 plperl.sgml *** doc/src/sgml/plperl.sgml6 Nov 2004 14:32:10 - 2.30 --- doc/src/sgml/plperl.sgml19 Nov 2004 18:52:34 - *** *** 174,189 $rv = spi_exec_query('SELECT * FROM my_table', 5); !This returns up to 5 rows from the table !my_table. If my_table !has a column my_column, it could be accessed !like this: $foo = $rv->{rows}[$i]->{my_column}; !The total number of rows returned can be accessed like this: ! $nrows = @{$rv->{rows}}; --- 174,190 $rv = spi_exec_query('SELECT * FROM my_table', 5); ! This returns up to 5 rows from the table ! my_table. If my_table ! has a column my_column, you can get the value that ! value from row $i from a ! SELECT like this: $foo = $rv->{rows}[$i]->{my_column}; !The total number of rows returned from a SELECT query can be accessed like this: ! $nrows = $rv->{processed} *** *** 200,206 To get the number of rows affected, do: ! $nrows = $rv->{rows}; --- 201,207 To get the number of rows affected, do: ! $nrows = $rv->{processed}; ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
On Fri, 19 Nov 2004 08:24:20 -0800 "Joshua D. Drake" <[EMAIL PROTECTED]> wrote: > > > Thank you ... I knew you guys celebrated later then us, just didn't > > know why ... do you guys celebrate Remembrance Day same as us, or > > different too? Ours is Nov 11 ... > > I don't even know what Rememberance Day is ;) It's what we call Veteran's Day and yes, Marc, it is on the same day as us. -- D'Arcy J.M. Cain <[EMAIL PROTECTED]> | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
"Joshua D. Drake" <[EMAIL PROTECTED]> writes: >> Thank you ... I knew you guys celebrated later then us, just didn't >> know why ... do you guys celebrate Remembrance Day same as us, or >> different too? Ours is Nov 11 ... > > I don't even know what Rememberance Day is ;) WWI ended on November 11, 1918. The British and their (ex-) colonies take the holiday more seriously than we do, possibly because they lost a million dead in that war... We have it too, but we call it Veterans' Day. -Doug ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
Thank you ... I knew you guys celebrated later then us, just didn't know why ... do you guys celebrate Remembrance Day same as us, or different too? Ours is Nov 11 ... I don't even know what Rememberance Day is ;) Sincerely, Joshua D. Drake Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: [EMAIL PROTECTED] Yahoo!: yscrappy ICQ: 7615664 ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html -- Command Prompt, Inc., home of PostgreSQL Replication, and plPHP. Postgresql support, programming shared hosting and dedicated hosting. +1-503-667-4564 - [EMAIL PROTECTED] - http://www.commandprompt.com Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL begin:vcard fn:Joshua D. Drake n:Drake;Joshua D. org:Command Prompt, Inc. adr:;;PO Box 215;Cascade Locks;Oregon;97014;USA email;internet:[EMAIL PROTECTED] title:Consultant tel;work:503-667-4564 tel;fax:503-210-0334 note:Command Prompt, Inc. is the largest and oldest US based commercial PostgreSQL support provider. We provide the only commercially viable integrated PostgreSQL replication solution, but also custom programming, and support. We authored the book Practical PostgreSQL, the procedural language plPHP, and adding trigger capability to plPerl. x-mozilla-html:FALSE url:http://www.commandprompt.com/ version:2.1 end:vcard ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
On Fri, 19 Nov 2004, Joshua D. Drake wrote: Humor the Canadian ... when is Thanksgiving? :) Next week.. :) Thursday. Thank you ... I knew you guys celebrated later then us, just didn't know why ... do you guys celebrate Remembrance Day same as us, or different too? Ours is Nov 11 ... Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: [EMAIL PROTECTED] Yahoo!: yscrappy ICQ: 7615664 ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
Humor the Canadian ... when is Thanksgiving? :) Next week.. :) Thursday. Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: [EMAIL PROTECTED] Yahoo!: yscrappy ICQ: 7615664 -- Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC Postgresql support, programming shared hosting and dedicated hosting. +1-503-667-4564 - [EMAIL PROTECTED] - http://www.commandprompt.com PostgreSQL Replicator -- production quality replication for PostgreSQL begin:vcard fn:Joshua Drake n:Drake;Joshua org:Command Prompt, Inc. adr:;;PO Box 215 ;Cascade Locks;OR;97014;US email;internet:[EMAIL PROTECTED] title:Consultant tel;work:503-667-4564 tel;fax:503-210-0334 x-mozilla-html:FALSE url:http://www.commandprompt.com version:2.1 end:vcard ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
Tom Lane said: > Josh Berkus <[EMAIL PROTECTED]> writes: >>> I would agree that seems a little odd ;). Would this be something we >>> want done for 8.0? > >> I think we'd better. Otherwise, people will get used to the broken >> syntax. > > Agreed. Someone's going to step up and patch this, no? > > (Not me --- I've already wasted more hours than I could afford this > week on plperl.) > I knew I should have looked at this closer when Peter made his complaint - it sounded familiar. IIRC it was actually a point I raised about the original code, and it was fixed. At any rate, last night Abhijit Menon-Sen and I looked at the code and got confused becuse it appears to have been fixed ;-). "rows" only contains data and only exists if the result is from a successful select. "processed" is the row count, and is always present. So it's a case of bad documentation, which we will fix very shortly. Sorry for the noise. cheers andrew ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
On Thu, 18 Nov 2004, Joshua D. Drake wrote: Agreed. Someone's going to step up and patch this, no? (Not me --- I've already wasted more hours than I could afford this week on plperl.) We can do it, but it will have to be after thanksgiving. Humor the Canadian ... when is Thanksgiving? :) Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: [EMAIL PROTECTED] Yahoo!: yscrappy ICQ: 7615664 ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
Agreed. Someone's going to step up and patch this, no? (Not me --- I've already wasted more hours than I could afford this week on plperl.) We can do it, but it will have to be after thanksgiving. J regards, tom lane -- Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC Postgresql support, programming shared hosting and dedicated hosting. +1-503-667-4564 - [EMAIL PROTECTED] - http://www.commandprompt.com PostgreSQL Replicator -- production quality replication for PostgreSQL begin:vcard fn:Joshua Drake n:Drake;Joshua org:Command Prompt, Inc. adr:;;PO Box 215 ;Cascade Locks;OR;97014;US email;internet:[EMAIL PROTECTED] title:Consultant tel;work:503-667-4564 tel;fax:503-210-0334 x-mozilla-html:FALSE url:http://www.commandprompt.com version:2.1 end:vcard ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
Josh Berkus <[EMAIL PROTECTED]> writes: >> I would agree that seems a little odd ;). Would this be something we >> want done for 8.0? > I think we'd better. Otherwise, people will get used to the broken syntax. Agreed. Someone's going to step up and patch this, no? (Not me --- I've already wasted more hours than I could afford this week on plperl.) regards, tom lane ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
Josh, > I would agree that seems a little odd ;). Would this be something we > want done for 8.0? I think we'd better. Otherwise, people will get used to the broken syntax. -- Josh Berkus Aglio Database Solutions San Francisco ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
Andrew Dunstan wrote: 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? I would agree that seems a little odd ;). Would this be something we want done for 8.0? Sincerely, Joshua D. Drake cheers andrew ___ Plperlng-devel mailing list [EMAIL PROTECTED] http://pgfoundry.org/mailman/listinfo/plperlng-devel -- Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC Postgresql support, programming shared hosting and dedicated hosting. +1-503-667-4564 - [EMAIL PROTECTED] - http://www.commandprompt.com PostgreSQL Replicator -- production quality replication for PostgreSQL begin:vcard fn:Joshua Drake n:Drake;Joshua org:Command Prompt, Inc. adr:;;PO Box 215 ;Cascade Locks;OR;97014;US email;internet:[EMAIL PROTECTED] title:Consultant tel;work:503-667-4564 tel;fax:503-210-0334 x-mozilla-html:FALSE url:http://www.commandprompt.com version:2.1 end:vcard ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
Re: [Plperlng-devel] Re: [HACKERS] Concern about new PL/Perl
Andrew, Peter, > >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? Hmmm ... while contextual data changes is perlish, substituting a scalar for an arrayref is going a little far.I agree with Peter, if the second # is needed, {nrows} makes more sense. -- Josh Berkus Aglio Database Solutions San Francisco ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html