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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| 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 |
| |||
| 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 ">" 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 |
| ||||
| 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 |