Doc patch: New PL/Perl Features

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

Doc patch: New PL/Perl Features

От:
David Fetter <david@fetter.org>
Дата:
Вложения:
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!

Re: [PATCHES] Doc patch: New PL/Perl Features

От:
David Fetter <david@fetter.org>
Дата:
Вложения:
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!

Re: [PATCHES] Doc patch: New PL/Perl Features

От:
Neil Conway <neilc@samurai.com>
Дата:
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.

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

Needs a  and a . Also the  doesn't compile 
using openjade 1.3.1

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

Needs  around "PostgreSQL" for consistency with the rest 
of the SGML docs.

> + 
> + 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;
> ! $$;
> ! 

Should probably use ">" not ">".

>        spi_exec_query</>(query [, max-rows])
>        spi_exec_query</>(command)
> +      spi_query</>(query)
> +      spi_fetchrow</>(result of spi_query)
> +      
> +      
>        
>         
>          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:
>   
>   
> ! custom_variable_classes = 'plr,pljava'
>   plr.path = '/usr/lib/R'
>   pljava.foo = 1
>   plruby.bar = true        # generates error, unknown class name
>   
>       
> --- 4103,4112 ----
>        when using custom variables:
>   
>   
> ! 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
>   
>       

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

-Neil

Re: Doc patch: New PL/Perl Features

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Your patch has been added to the PostgreSQL unapplied patches list at:

	http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

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


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

Re: Doc patch: New PL/Perl Features

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

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
FAQ