Unix Technical Forum

Doc patch: New PL/Perl Features

This is a discussion on Doc patch: New PL/Perl Features within the Pgsql Patches forums, part of the PostgreSQL category; --> Folks, Please find enclosed document patches for PL/Perl features recently introduced in CVS TIP. These include: return_next returning PostgreSQL ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 12:40 AM
David Fetter
 
Posts: n/a
Default Doc patch: New PL/Perl Features

Folks,

Please find enclosed document patches for PL/Perl features recently
introduced in CVS TIP. These include:

return_next
returning PostgreSQL arrays
spi_query/spi_fetchrow
use strict

Cheers,
D
--
David Fetter david@fetter.org http://fetter.org/
phone: +1 510 893 6100 mobile: +1 415 235 3778

Remember to vote!


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 12:40 AM
David Fetter
 
Posts: n/a
Default Re: Doc patch: New PL/Perl Features

On Tue, Jul 12, 2005 at 12:21:29PM -0700, David Fetter wrote:
> Folks,
>
> Please find enclosed document patches for PL/Perl features recently
> introduced in CVS TIP. These include:
>
> return_next
> returning PostgreSQL arrays
> spi_query/spi_fetchrow
> use strict
>
> Cheers,
> D


Oops. Persuant to corrections and clarifications by Andrew Dunstan,
please find enclosed a better patch.

Cheers,
D
--
David Fetter david@fetter.org http://fetter.org/
phone: +1 510 893 6100 mobile: +1 415 235 3778

Remember to vote!


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-18-2008, 12:40 AM
Neil Conway
 
Posts: n/a
Default Re: Doc patch: New PL/Perl Features

David Fetter wrote:
> On Tue, Jul 12, 2005 at 12:21:29PM -0700, David Fetter wrote:
>
>>Folks,
>>
>>Please find enclosed document patches for PL/Perl features recently
>>introduced in CVS TIP. These include:
>>
>>return_next
>>returning PostgreSQL arrays
>>spi_query/spi_fetchrow
>>use strict
>>
>>Cheers,
>>D

>
>
> Oops. Persuant to corrections and clarifications by Andrew Dunstan,
> please find enclosed a better patch.


Applied with editorialization; see comments below. Thanks for the patch.

> + <itemizedlist>
> + <listitem>
> + <para>
> + Globally, by turning on plperl (one of the <xref
> + linkend="guc-custom-variable-classes"
> + endterm="custom_variable_classes"> you can use) and setting
> + plperl.use_strict to true in your postgresql.conf, or
> + </para>


Needs a <filename/> and a <literal/>. Also the <xref/> doesn't compile
using openjade 1.3.1

> <para>
> + Perl can return PostgreSQL arrays as references to Perl arrays.
> + Here is an example:


Needs <productname/> around "PostgreSQL" for consistency with the rest
of the SGML docs.

> + <programlisting>
> + CREATE OR REPLACE function returns_array()
> + RETURNS text[][]
> + LANGUAGE plperl
> + AS $$
> + return [['a"b','c,d'],['e\\f','g']];
> + $$;
> +
> + select returns_array();


CREATE FUNCTION ... AS $$ ... $$ LANGUAGE plperl; would be more
consistent with the other PL/Perl examples.

> ! CREATE OR REPLACE FUNCTION perl_set()
> ! RETURNS SETOF testrowperl
> ! LANGUAGE plperl AS $$
> ! return_next({f1 => 1, f2 => 'Hello', f3 => 'World' });
> ! return_next({ f1 => 2, f2 => 'Hello', f3 => 'PostgreSQL' });
> ! return_next({ f1 => 3, f2 => 'Hello', f3 => 'PL/Perl' });
> ! return undef;
> ! $$;
> ! </programlisting>


Should probably use "&gt;" not ">".

> <term><literal><function>spi_exec_query</>(<replaceable>query</replaceable> [, <replaceable>max-rows</replaceable>])</literal></term>
> <term><literal><function>spi_exec_query</>(<replaceable>command</replaceable>)</literal></term>
> + <term><literal><function>spi_query</>(<replaceable>query</replaceable>)</literal></term>
> + <term><literal><function>spi_fetchrow</>(<replaceable>result of spi_query</replaceable>)</literal></term>
> + <term><literal>
> + </literal></term>
> <listitem>
> <para>
> Executes an SQL command. Here is an example of a query


This needs more work -- the difference in behavior between spi_query()
and spi_exec_query() is not described, so I didn't apply this hunk.

> *** 4103,4111 ****
> when using custom variables:
>
> <programlisting>
> ! custom_variable_classes = 'plr,pljava'
> plr.path = '/usr/lib/R'
> pljava.foo = 1
> plruby.bar = true # generates error, unknown class name
> </programlisting>
> </para>
> --- 4103,4112 ----
> when using custom variables:
>
> <programlisting>
> ! custom_variable_classes = 'plperl,plr,pljava'
> plr.path = '/usr/lib/R'
> pljava.foo = 1
> + plperl.use_strict = true # now without having to use pl/perlU!
> plruby.bar = true # generates error, unknown class name
> </programlisting>
> </para>


I didn't see why this was relevant, so I didn't apply it.

-Neil

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-18-2008, 12:40 AM
Bruce Momjian
 
Posts: n/a
Default Re: [DOCS] Doc patch: New PL/Perl Features


Oops, already applied. (Seems my threading email is busted.)

---------------------------------------------------------------------------

David Fetter wrote:
> Folks,
>
> Please find enclosed document patches for PL/Perl features recently
> introduced in CVS TIP. These include:
>
> return_next
> returning PostgreSQL arrays
> spi_query/spi_fetchrow
> use strict
>
> Cheers,
> D
> --
> David Fetter david@fetter.org http://fetter.org/
> phone: +1 510 893 6100 mobile: +1 415 235 3778
>
> Remember to vote!


[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings


--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:17 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com