[HACKERS] Optimize PL/Perl function argument passing [PATCH]

2010-12-07 Thread Tim Bunce
Changes: Sets the local $_TD via C instead of passing an extra argument. So functions no longer start with "our $_TD; local $_TD = shift;" Pre-extend stack for trigger arguments for slight performance gain. Passes installcheck. Tim. diff --git a/src/pl/plperl/plperl.c b/src/pl/plper

Re: [HACKERS] Optimize PL/Perl function argument passing [PATCH]

2010-12-08 Thread Tim Bunce
On Tue, Dec 07, 2010 at 10:00:28AM -0500, Andrew Dunstan wrote: > > > On 12/07/2010 09:24 AM, Tim Bunce wrote: > >Changes: > > > > Sets the local $_TD via C instead of passing an extra argument. > > So functions no longer start with "our $_TD; local

Re: [HACKERS] Optimize PL/Perl function argument passing [PATCH]

2010-12-09 Thread Tim Bunce
On Wed, Dec 08, 2010 at 09:21:05AM -0800, David E. Wheeler wrote: > On Dec 8, 2010, at 9:14 AM, Tim Bunce wrote: > > >> Do you have any more improvements in the pipeline? > > > > I'd like to add $arrayref = decode_array_literal('{2,3}') and > > ma

Re: [HACKERS] Package namespace and Safe init cleanup for plperl UPDATE 3 [PATCH]

2010-02-02 Thread Tim Bunce
On Mon, Feb 01, 2010 at 07:53:05PM -0700, Alex Hunsaker wrote: > On Mon, Feb 1, 2010 at 03:58, Tim Bunce wrote: > > On Sat, Jan 30, 2010 at 06:38:59PM -0700, Alex Hunsaker wrote: > > > >> plc_safe_ok.pl seems to loose its CVS $PostgreSQL$ keyword. > >Probably a sli

Re: [HACKERS] Add on_trusted_init and on_untrusted_init to plperl UPDATED [PATCH]

2010-02-03 Thread Tim Bunce
On Tue, Feb 02, 2010 at 08:42:21PM -0700, Alex Hunsaker wrote: > On Sat, Jan 30, 2010 at 08:49, Tim Bunce wrote: > > >    SPI functions are not available when the code is run. > > Hrm, we might want to stick why in the docs or as a comment somewhere. > I think this

Re: [HACKERS] Add on_trusted_init and on_untrusted_init to plperl UPDATED [PATCH]

2010-02-03 Thread Tim Bunce
On Wed, Feb 03, 2010 at 10:18:51AM -0700, Alex Hunsaker wrote: > On Wed, Feb 3, 2010 at 09:31, Tim Bunce wrote: > > On Tue, Feb 02, 2010 at 08:42:21PM -0700, Alex Hunsaker wrote: > >> On Sat, Jan 30, 2010 at 08:49, Tim Bunce wrote: > >> > >> >    SPI funct

Re: [HACKERS] Add on_trusted_init and on_untrusted_init to plperl UPDATED [PATCH]

2010-02-03 Thread Tim Bunce
On Wed, Feb 03, 2010 at 02:04:47PM -0500, Tom Lane wrote: > Andrew Dunstan writes: > > %_SHARED has been around for several years now, and if there are genuine > > security concerns about it ISTM they would apply today, regardless of > > these patches. > > Yes. I am not at all happy about inse

[HACKERS] Add on_plperl_init and on_plperlu_init to plperl UPDATE 3 [PATCH]

2010-02-05 Thread Tim Bunce
This is the third update to the fourth of the patches to be split out from the former 'plperl feature patch 1'. Changes in this patch: - Added plperl.on_plperl_init and plperl.on_plperlu_init GUCs Both are PGC_SUSET SPI functions are not available when the code is run. Errors are dete

Re: [HACKERS] Confusion over Python drivers

2010-02-05 Thread Tim Bunce
On Fri, Feb 05, 2010 at 09:19:26AM -0500, Bruce Momjian wrote: > My son has brought to my attention that our current crop of Python > client libraries is inadequate/confusing. I took a look myself, and > asked on our IRC channel, and am now convinced this area needs > attention. > > http://

Re: [HACKERS] damage control mode

2010-02-07 Thread Tim Bunce
On Sat, Feb 06, 2010 at 10:38:00PM -0800, Josh Berkus wrote: > > Add on_trusted_init and on_untrusted_init to plperl > Package namespace and Safe init cleanup for plperl Alex Hunsaker has marked the latest version of both of those as Ready for Committer. Tim. -- Sent via pgsql-hackers mailing

Re: [HACKERS] Add on_plperl_init and on_plperlu_init to plperl UPDATE 3 [PATCH]

2010-02-08 Thread Tim Bunce
On Sun, Feb 07, 2010 at 08:25:33PM -0500, Andrew Dunstan wrote: > Tim Bunce wrote: > >This is the third update to the fourth of the patches to be split out > >from the former 'plperl feature patch 1'. > > > >Changes in this patch: > > > >- Added

Re: [HACKERS] Add on_plperl_init and on_plperlu_init to plperl UPDATE 3 [PATCH]

2010-02-08 Thread Tim Bunce
On Mon, Feb 08, 2010 at 01:44:16PM +, Tim Bunce wrote: > > > I'll continue reviewing the patch, but these things at least need fixing. Here's an updated patch. The only changes relative to the previous version are in the docs, as I outlined in the previous message.

Re: [HACKERS] Add on_plperl_init and on_plperlu_init to plperl UPDATE 3 [PATCH]

2010-02-08 Thread Tim Bunce
[Sigh. This email, unlike the previous, actually includes the patch.] On Mon, Feb 08, 2010 at 01:44:16PM +, Tim Bunce wrote: > > > I'll continue reviewing the patch, but these things at least need fixing. Here's an updated patch. The only changes relative to the previous

Re: [HACKERS] Add on_trusted_init and on_untrusted_init to plperl UPDATED [PATCH]

2010-02-12 Thread Tim Bunce
On Fri, Feb 12, 2010 at 12:22:28AM -0500, Robert Haas wrote: > On Wed, Feb 3, 2010 at 6:41 PM, Andrew Dunstan wrote: > > Tom Lane wrote: > >> Andrew Dunstan writes: > >> > >>> %_SHARED has been around for several years now, and if there are genuine > >>> security concerns about it ISTM they would

[HACKERS] PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl

2010-02-12 Thread Tim Bunce
There was some discussion a few weeks ago about inter-stored-procedure calling from PL/Perl. I thought I'd post the documentation (and tests) for a module I'm working on to simplify calling SQL functions from PL/Perl. Here are some real-world examples (not the best code, but genuine use-cases):

[HACKERS] Re: PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl

2010-02-12 Thread Tim Bunce
On Fri, Feb 12, 2010 at 11:10:15PM +, Tim Bunce wrote: > I've appended the POD documentation and attached the (rough but working) > test script. Oops. Here's the test script. Tim. create or replace function test_call() returns text language plperlu as $func$ use lib

Re: [HACKERS] Package namespace and Safe init cleanup for plperl [PATCH]

2010-02-12 Thread Tim Bunce
On Fri, Feb 12, 2010 at 02:30:37PM -0700, Alex Hunsaker wrote: > On Fri, Feb 12, 2010 at 13:42, Andrew Dunstan wrote: > > Alex Hunsaker wrote: > > > and leave the rest for the next release, unless you can > > convince me real fast that we're not opening a back door here. If we're > > going to

Re: [HACKERS] Package namespace and Safe init cleanup for plperl [PATCH]

2010-02-13 Thread Tim Bunce
On Fri, Feb 12, 2010 at 07:57:15PM -0500, Andrew Dunstan wrote: > Alex Hunsaker wrote: > > Yes it could allow people who > >can set the plperl.*_init functions to muck with the safe. As an > >admin I could also do that by setting plperl.on_init and overloading > >subs in the Safe namespace or swi

Re: [HACKERS] PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl

2010-02-15 Thread Tim Bunce
On Mon, Feb 15, 2010 at 07:31:14AM +, Richard Huxton wrote: > On 12/02/10 23:10, Tim Bunce wrote: > >There was some discussion a few weeks ago about inter-stored-procedure > >calling from PL/Perl. > > >I'd greatly appreciate any feedback. > > Looks gre

Re: [HACKERS] PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl

2010-02-15 Thread Tim Bunce
On Sat, Feb 13, 2010 at 02:25:48PM -0800, David E. Wheeler wrote: > On Feb 12, 2010, at 3:10 PM, Tim Bunce wrote: > > > I've appended the POD documentation and attached the (rough but working) > > test script. > > > > I plan to release the module to CPAN i

Re: [HACKERS] CommitFest Status Summary - 2010-02-14

2010-02-15 Thread Tim Bunce
so on_proc_exit will only be called if plperl_*_init() succeeds (else there's a risk of on_proc_exit consuming all the exit hook slots) - don't allow use of Safe version 2.21 as that's broken for PL/Perl. Tim. commit d8c0d4e63c00606db95f95a9c8f2b7ccf3c819b3 Author: Tim Bunce

Re: [HACKERS] PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl

2010-02-15 Thread Tim Bunce
On Mon, Feb 15, 2010 at 10:42:15AM +, Richard Huxton wrote: > On 15/02/10 10:32, Tim Bunce wrote: > >On Mon, Feb 15, 2010 at 07:31:14AM +, Richard Huxton wrote: > >> > >>Is there any value in having a two-stage interface? > >> > >>$seq_fn =

Re: [HACKERS] PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl

2010-02-15 Thread Tim Bunce
On Mon, Feb 15, 2010 at 10:51:14AM +, Tim Bunce wrote: > On Sat, Feb 13, 2010 at 02:25:48PM -0800, David E. Wheeler wrote: > > On Feb 12, 2010, at 3:10 PM, Tim Bunce wrote: > > > > > I've appended the POD documentation and attached the (rough but working) >

Re: [HACKERS] PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl

2010-02-15 Thread Tim Bunce
On Mon, Feb 15, 2010 at 11:52:01AM -0800, David E. Wheeler wrote: > On Feb 15, 2010, at 2:51 AM, Tim Bunce wrote: > > > The signature doesn't just qualify the selection of the function, > > it also ensures appropriate interpretation of the arguments. > > > &

Re: [HACKERS] PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl

2010-02-16 Thread Tim Bunce
On Mon, Feb 15, 2010 at 02:58:47PM -0800, David E. Wheeler wrote: > On Feb 15, 2010, at 2:42 PM, Tim Bunce wrote: > > > I've not really looked the the DBD::Pg code much so this seemed like a > > good excuse... It looks like the default is to call PQprepare() with > &g

Re: [HACKERS] PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl

2010-02-16 Thread Tim Bunce
On Tue, Feb 16, 2010 at 09:11:24AM -0800, David E. Wheeler wrote: > On Feb 16, 2010, at 4:08 AM, Tim Bunce wrote: > > From the docs: > > > Immediately after the function name, in parenthesis, a comma separated list > > of > > type names can be given.

Re: [HACKERS] CommitFest Status Summary - 2010-02-14

2010-02-16 Thread Tim Bunce
On Tue, Feb 16, 2010 at 04:42:29PM -0500, Andrew Dunstan wrote: > Tim Bunce wrote: > >On Sun, Feb 14, 2010 at 10:14:28PM -0500, Andrew Dunstan wrote: > >>Robert Haas wrote: > >>>We're down to 5 patches remaining, and 1 day remaining, so it's time > >&g

Re: [HACKERS] CommitFest Status Summary - 2010-02-14

2010-02-17 Thread Tim Bunce
On Tue, Feb 16, 2010 at 02:25:00PM -0800, David E. Wheeler wrote: > On Feb 16, 2010, at 2:19 PM, Tim Bunce wrote: > > > p.s. One quick heads-up: David Wheeler has reported a possible issue > > with Safe 2.21. I hope to investigate that tomorrow. > > Actually it'

Re: [HACKERS] CommitFest Status Summary - 2010-02-14

2010-02-17 Thread Tim Bunce
On Tue, Feb 16, 2010 at 05:22:27PM -0500, Robert Haas wrote: > > It's certainly been an interesting introduction to PostgreSQL > > development! > > Hopefully we haven't scared you off - your work is definitely very > much appreciated (and I at least hope to see you back for 9.1)! Thanks Robert. T

Re: [HACKERS] PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl

2010-02-17 Thread Tim Bunce
On Tue, Feb 16, 2010 at 02:13:30PM -0800, David E. Wheeler wrote: > On Feb 16, 2010, at 2:06 PM, Tim Bunce wrote: > > >>> For varadic functions, separate plans are created and cached for each > >>> distinct > >>> number of arguments the function is call

Re: [HACKERS] GUC failure on exception

2010-02-17 Thread Tim Bunce
Did this ever get turned into a formal bug report with a number? Tim. On Thu, Jan 14, 2010 at 07:39:09PM -0500, Andrew Dunstan wrote: > > Tim Bunce just showed me the following oddity: > >andrew=# SET SESSION plperl.use_strict = on; >SET >andrew=# SHOW

Re: [HACKERS] PostgreSQL::PLPerl::Call - Simple interface for calling SQL functions from PostgreSQL PL/Perl

2010-02-18 Thread Tim Bunce
On Wed, Feb 17, 2010 at 10:30:03AM -0800, David E. Wheeler wrote: > On Feb 17, 2010, at 4:28 AM, Tim Bunce wrote: > > >> Yes, but if it's a variadic function, I suspect that it won't often be > >> called with the same number of args. So you'd potentially e

[HACKERS] Safe security (was: plperl _init settings)

2010-03-03 Thread Tim Bunce
On Tue, Mar 02, 2010 at 07:33:47PM -0500, Andrew Dunstan wrote: > > There appears to be some significant misunderstanding of what can be > done effectively using the various *_init settings for plperl. > > In particular, some people have got an expectation that modules > loaded in plperl.on_init

[HACKERS] Core dump running PL/Perl installcheck with bleadperl [PATCH]

2010-03-05 Thread Tim Bunce
I encountered a core dump running PL/Perl installcheck with a very recent git HEAD of PostgreSQL and a not quite so recent git HEAD of perl. The cause is a subtle difference between SvTYPE(sv) == SVt_RV and SvROK(sv). The former is checking a low-level implementation detail while the later is dire

Re: [HACKERS] Core dump running PL/Perl installcheck with bleadperl [PATCH]

2010-03-08 Thread Tim Bunce
On Sun, Mar 07, 2010 at 12:11:26PM -0500, Tom Lane wrote: > Tim Bunce writes: > > I encountered a core dump running PL/Perl installcheck with a very > > recent git HEAD of PostgreSQL and a not quite so recent git HEAD of perl. > > > The cause is a subtle difference betw

Re: [HACKERS] Safe security

2010-03-08 Thread Tim Bunce
On Wed, Mar 03, 2010 at 07:01:56PM -0500, Andrew Dunstan wrote: > Joshua D. Drake wrote: > >On Wed, 2010-03-03 at 11:33 -0500, Andrew Dunstan wrote: > > > >>Well, we could put in similar weasel words I guess. But after > >>all, Safe's very purpose is to provide a restricted execution > >>environmen

Re: [HACKERS] Safe security

2010-03-08 Thread Tim Bunce
On Mon, Mar 08, 2010 at 11:03:27AM -0500, Tom Lane wrote: > Tim Bunce writes: > > Here's a patch that: > > 1. adds wording like that to the docs. > > 2. randomises the container package name (a simple and sound security > > measure). > > 3. requires Safe 2.2

Re: [HACKERS] release notes

2010-05-22 Thread Tim Bunce
On Mon, May 17, 2010 at 11:34:37AM -0400, Tom Lane wrote: > Andrew Dunstan writes: > > Why do the release notes say this, under plperl: > > * PL/Perl subroutines are now given names (Tim Bunce) > > This is for the use of profiling and code coverage tools. DIDN&

Re: [HACKERS] Optimize PL/Perl function argument passing [PATCH]

2011-02-02 Thread Tim Bunce
On Mon, Jan 31, 2011 at 02:22:37PM -0500, Andrew Dunstan wrote: > > > On 01/15/2011 12:31 AM, Alex Hunsaker wrote: > >On Tue, Dec 7, 2010 at 07:24, Tim Bunce wrote: > >>Changes: > >> > >>Sets the local $_TD via C instead of passing an extra argu

Re: [HACKERS] arrays as pl/perl input arguments [PATCH]

2011-02-02 Thread Tim Bunce
I'm sorry I'm late to this party. I haven't been keeping up with pgsql-hackers. I'd kind'a hoped that this functionality could be tied into extending PL/Perl to handle named arguments. That way the perl variables corresponding to the named arguments could be given references without breaking any c

Re: [HACKERS] Optimize PL/Perl function argument passing [PATCH]

2011-02-03 Thread Tim Bunce
On Wed, Feb 02, 2011 at 12:10:59PM -0500, Andrew Dunstan wrote: > > On 02/02/2011 11:45 AM, Tim Bunce wrote: > >>But why are we bothering to keep $prolog at > >>all any more, if all we're going to pass it is&PL_sv_no all the > >>time? Maybe we'll ha

Re: [HACKERS] arrays as pl/perl input arguments [PATCH]

2011-02-03 Thread Tim Bunce
On Thu, Feb 03, 2011 at 02:23:32PM +0200, Alexey Klyukin wrote: > Hi, > > On Feb 2, 2011, at 7:16 PM, Tim Bunce wrote: > > > I'm sorry I'm late to this party. I haven't been keeping up with > > pgsql-hackers. > > Better late than never :) > &g

Re: [HACKERS] arrays as pl/perl input arguments [PATCH]

2011-02-09 Thread Tim Bunce
On Tue, Feb 08, 2011 at 09:40:38AM -0500, Andrew Dunstan wrote: > On 02/03/2011 01:20 PM, Andrew Dunstan wrote: > > > >Well, the question seems to be whether or not it's a reasonable > >price to pay. On the whole I'm inclined to think it is, especially > >when it can be avoided by updating your cod

Re: [HACKERS] arrays as pl/perl input arguments [PATCH]

2011-02-16 Thread Tim Bunce
On Sat, Feb 12, 2011 at 02:17:12AM +0200, Alexey Klyukin wrote: > > So, here is the v8. Instead of rewriting the encode_array_literal I've added > another function, encode_type_literal (could use a better name). Given that encode_array_literal() encodes an _array_ as a literal, I'd assume encode_

PL/Perl function naming (was: [HACKERS] release notes)

2010-06-15 Thread Tim Bunce
[Sorry for the delay. I'd stopped checking the pgsql mailing lists. Thanks to David Wheeler and Josh Berkus for the heads-up.] On Sun, May 30, 2010 at 06:58:32PM -0400, Andrew Dunstan wrote: > > Tim Bunce wrote: > >On Mon, May 17, 2010 at 11:34:37AM -0400, Tom Lane wrote: &

Re: [HACKERS] plperl crash with Debian 6 (64 bit), pl/perlu, libwww and https

2011-08-07 Thread Tim Bunce
[I've included a summary of the thread and Bcc'd this to perl5-porters for a sanity check. Please trim heavily when replying.] On Thu, Aug 04, 2011 at 09:42:31AM -0400, Andrew Dunstan wrote: > > So doesn't this look like a bug in the perl module that sets the > signal handler and doesn't restore

Re: [HACKERS] plperl crash with Debian 6 (64 bit), pl/perlu, libwww and https

2011-08-08 Thread Tim Bunce
On Mon, Aug 08, 2011 at 01:23:08AM -0600, Alex Hunsaker wrote: > On Sun, Aug 7, 2011 at 17:06, Tim Bunce wrote: > > > Localizing an individual element of %SIG works fine. > > In C that's something like this (untested): > > > >    hv = gv_fetchpv("

Re: [HACKERS] Initial refactoring of plperl.c [PATCH]

2009-11-30 Thread Tim Bunce
On Sat, Nov 28, 2009 at 09:35:10AM -0500, Andrew Dunstan wrote: > > Tim Bunce wrote: >> - Changed MULTIPLICITY check from runtime to compiletime. >> No loads the large Config module. > > ISTM the trouble with this is that it assumes that the library that we > comp

Re: [HACKERS] Initial refactoring of plperl.c [PATCH]

2009-11-30 Thread Tim Bunce
On Mon, Nov 30, 2009 at 12:50:41PM -0500, Andrew Dunstan wrote: > > Tim Bunce wrote: >> In summary, changing between multiplicity and non-multiplicity libperls >> after building postgresql isn't safe or supported. > > OK, good. Are you adding a check at load time that

[HACKERS] Initial refactoring of plperl.c - rebased [PATCH]

2009-12-02 Thread Tim Bunce
I've attached an update of my previous refactoring of plperl.c. It's been rebased over the current (git) HEAD and has a few very minor additions. Background: I've started work on the enhancements to plperl I outlined on pg-general (in the "Wishlist of PL/Perl Enhancements for 8.5" thread). I have

[HACKERS] First feature patch for plperl - draft [PATCH]

2009-12-03 Thread Tim Bunce
Building on my earlier plperl refactoring patch, here's a draft of my first plperl feature patch. Significant changes in this patch: - New GUC plperl.on_perl_init='...perl...' for admin use. - New GUC plperl.on_trusted_init='...perl...' for plperl user use. - New GUC plperl.on_untrusted_init='...

Re: [HACKERS] First feature patch for plperl - draft [PATCH]

2009-12-04 Thread Tim Bunce
On Thu, Dec 03, 2009 at 04:53:47PM -0800, David E. Wheeler wrote: > On Dec 3, 2009, at 3:30 PM, Tim Bunce wrote: > > > - New GUC plperl.on_perl_init='...perl...' for admin use. > > - New GUC plperl.on_trusted_init='...perl...' for plperl user use. > >

Re: [HACKERS] First feature patch for plperl - draft [PATCH]

2009-12-04 Thread Tim Bunce
On Fri, Dec 04, 2009 at 11:01:42AM -0500, Tom Lane wrote: > Jeff writes: > > Is there any possible way to enable "use strict;" for plperl (trusted) > > modules? > > The plperl manual shows a way to do it using some weird syntax or > other. It'd sure be nice to be able to use the regular syntax

Re: [HACKERS] Initial refactoring of plperl.c - rebased [PATCH]

2009-12-04 Thread Tim Bunce
On Thu, Dec 03, 2009 at 03:47:21PM -0800, Josh Berkus wrote: > Tim, > > Since there's a commitfest on right now, meaningful feedback on your > patch could be delayed. Just so you know. Understood. Thanks Josh. Tim. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make

Re: [HACKERS] First feature patch for plperl - draft [PATCH]

2009-12-04 Thread Tim Bunce
On Fri, Dec 04, 2009 at 02:05:28PM -0500, Tom Lane wrote: > Robert Haas writes: > > So, do we look for another way to provide the functionality besides > > having a GUC, or is the functionality itself bad? > > I don't think we want random Perl code running inside the postmaster, > no matter what

Re: [HACKERS] First feature patch for plperl - draft [PATCH]

2009-12-05 Thread Tim Bunce
On Sat, Dec 05, 2009 at 01:21:22AM -0500, Tom Lane wrote: > "David E. Wheeler" writes: > > Tom, what's your objection to Shlib load time being user-visible? > > It's not really designed to be user-visible. Let me give you just > two examples: > > * We call a plperl function for the first time i

Re: [HACKERS] First feature patch for plperl - draft [PATCH]

2009-12-05 Thread Tim Bunce
On Sat, Dec 05, 2009 at 11:41:36AM -0500, Tom Lane wrote: > Tim Bunce writes: > > I'll modify the patch to disable the SPI functions during > > initialization (both on_perl_init and on_(un)trusted_init). > > Yeah, in the shower this morning I was thinking that not lo

Re: [HACKERS] YAML

2009-12-08 Thread Tim Bunce
On Mon, Dec 07, 2009 at 07:07:13PM -0500, Andrew Dunstan wrote: > > > Josh Berkus wrote: >>> Not everything is sanely convertible into some sort of plugin. A plugin >>> mechanism for this would be FAR more trouble that it is worth, IMNSHO. >>> >>> We are massively over-egging this pudding (as a cul

[HACKERS] Minimum perl version supported

2009-12-21 Thread Tim Bunce
On Sun, Dec 20, 2009 at 10:55:55PM -0500, Robert Haas wrote: > On Sun, Dec 20, 2009 at 10:23 PM, Tom Lane wrote: > > Andres Freund writes: > >> On Monday 21 December 2009 02:23:39 Robert Haas wrote: > >>> A more important point is whether we really need to make this > >>> dependent on Perl 5.6 or

Re: [HACKERS] Initial refactoring of plperl.c [PATCH]

2009-12-21 Thread Tim Bunce
I've submitted this patch to the open CommitFest https://commitfest.postgresql.org/action/patch_view?id=245 Tim. On Wed, Nov 25, 2009 at 03:36:25PM +0000, Tim Bunce wrote: > Following on from my earlier draft plperl.c refactoring patch, here's a > new version that's complete

Re: [HACKERS] Minimum perl version supported

2009-12-21 Thread Tim Bunce
On Mon, Dec 21, 2009 at 10:09:58AM -0500, Tom Lane wrote: > Magnus Hagander writes: > > 2009/12/21 Robert Haas : > >> On Mon, Dec 21, 2009 at 5:45 AM, Tim Bunce wrote: > >>> plperl requires Safe v2.09, released in Oct 2003 and included in 5.8.1. > >>> T

Re: [HACKERS] Minimum perl version supported

2009-12-21 Thread Tim Bunce
On Mon, Dec 21, 2009 at 08:22:54AM -0800, David E. Wheeler wrote: > On Dec 21, 2009, at 7:18 AM, Tim Bunce wrote: > > >> Given the above three things it seems like we could define 5.8.1 as the > >> minimum required version. > > > > I'd be delighted

Re: [HACKERS] Segfault from PL/Perl Returning vstring

2009-12-21 Thread Tim Bunce
On Mon, Dec 21, 2009 at 02:46:17PM -0500, Andrew Dunstan wrote: > > > David E. Wheeler wrote: >> At least I think it's a segfault. This function returns a vstring: >> >> CREATE OR REPLACE FUNCTION wtf( >> ) RETURNS text LANGUAGE plperl IMMUTABLE STRICT AS $X$ >> return $^V; >> $X$; >> >> Here's

Re: [HACKERS] Initial refactoring of plperl.c - rebased [PATCH]

2009-12-25 Thread Tim Bunce
On Fri, Dec 25, 2009 at 12:54:13PM -0500, Andrew Dunstan wrote: > Tim Bunce wrote: >> I've attached an update of my previous refactoring of plperl.c. >> It's been rebased over the current (git) HEAD and has a few >> very minor additions. >> > [snip] &

Re: [HACKERS] Update ppport.h in plperl

2009-12-25 Thread Tim Bunce
On Thu, Dec 24, 2009 at 11:08:49AM -0500, Andrew Dunstan wrote: > Tim Bunce wrote: >> I'm about ready to post the next draft of my plperl feature patch. >> >> When I looked at the diff I saw ~7800 lines of it were just due to >> updating ppport.h. So I'v

[HACKERS] Status of plperl inter-sp calling

2009-12-30 Thread Tim Bunce
While waiting for feedback on my earlier plperl refactor and feature patches I'm working on a further patch that adds, among other things, fast inter-plperl-sp calling. I want to outline what I've got and get some feedback on open issues. To make a call to a stored procedure from plperl you just

Re: [HACKERS] Status of plperl inter-sp calling

2010-01-05 Thread Tim Bunce
On Thu, Dec 31, 2009 at 09:47:24AM -0800, David E. Wheeler wrote: > On Dec 30, 2009, at 2:54 PM, Tim Bunce wrote: > > > That much works currently. Behind the scenes, when a stored procedure is > > loaded into plperl the code ref for the perl sub is stored in a cache. &g

Re: [HACKERS] Status of plperl inter-sp calling

2010-01-05 Thread Tim Bunce
On Tue, Jan 05, 2010 at 01:05:40PM -0800, David E. Wheeler wrote: > On Jan 5, 2010, at 12:59 PM, Tim Bunce wrote: > > > So you're suggesting SP::foo(...) _always_ executes foo(...) via bunch > > of spi_* calls. Umm. I thought performance was a major driving factor. >

Re: [HACKERS] Status of plperl inter-sp calling

2010-01-05 Thread Tim Bunce
Ok, Plan B... Consider this (hypothetical) example: CREATE OR REPLACE FUNCTION test() ... LANGUAGE plperl AS $$ use SP foo_int => 'foo(int)'; use SP foo_text => 'foo(text)', -cached; foo_int(42); foo_text(42); ... $$ Here the user is importing i

Re: [HACKERS] Status of plperl inter-sp calling

2010-01-06 Thread Tim Bunce
On Tue, Jan 05, 2010 at 06:54:36PM -0500, Tom Lane wrote: > Tim Bunce writes: > > On Thu, Dec 31, 2009 at 09:47:24AM -0800, David E. Wheeler wrote: > >> Definite benefit, there. How does it handle the difference between > >> IMMUTABLE | STABLE | VOLATILE, as well as

Re: [HACKERS] Status of plperl inter-sp calling

2010-01-06 Thread Tim Bunce
On Tue, Jan 05, 2010 at 07:06:35PM -0500, Tom Lane wrote: > Tim Bunce writes: > > The only question I have at the moment, before I try implementing this, > > is the the need for freeing the plan. When would that be needed? > > There's probably no strong need to

Re: [HACKERS] Status of plperl inter-sp calling

2010-01-06 Thread Tim Bunce
On Wed, Jan 06, 2010 at 01:45:45PM -0800, David E. Wheeler wrote: > On Jan 6, 2010, at 12:20 PM, Tom Lane wrote: > > > One of the things on my to-do list for today is to make configure reject > > Perl versions less than $TBD. I thought we had agreed a week or so back > > that 5.8 was the lowest s

Re: [HACKERS] Status of plperl inter-sp calling

2010-01-06 Thread Tim Bunce
On Wed, Jan 06, 2010 at 11:41:46AM -0500, Tom Lane wrote: > Andrew Dunstan writes: > > Next question: what do we do if a direct-called function calls > > return_next()? That at least must surely take effect in the caller's > > context - the callee won't have anywhere to stash the the results at

[HACKERS] Testing plperl<->plperlu interaction

2010-01-06 Thread Tim Bunce
I was investigating a bug in an 8.4.1 production system and distilled a test case down to this: CREATE OR REPLACE FUNCTION bar() RETURNS integer AS $$ #die 'BANG!'; # causes server process to exit(2) # alternative - causes server process to exit(255) spi_exec_query("inv

Re: [HACKERS] Testing plperl<->plperlu interaction

2010-01-07 Thread Tim Bunce
On Wed, Jan 06, 2010 at 07:07:12PM -0500, Andrew Dunstan wrote: > > Alvaro Herrera wrote: > >decibel wrote: > > > >>We've actually run into similar issues. Alvaro came up with a patch > >>that fixes our specific issue, but I think he said there were some > >>other cases that needed to be fixed as

Re: [HACKERS] Status of plperl inter-sp calling

2010-01-07 Thread Tim Bunce
On Wed, Jan 06, 2010 at 08:46:11PM -0500, Tom Lane wrote: > Tim Bunce writes: > > On Wed, Jan 06, 2010 at 01:45:45PM -0800, David E. Wheeler wrote: > >> On Jan 6, 2010, at 12:20 PM, Tom Lane wrote: > >>> One of the things on my to-do list for today is to make config

[HACKERS] Add .gitignore files to CVS?

2010-01-07 Thread Tim Bunce
I've a .git/info/exclude file I pulled from a link on the dev wiki. Some of the changes I'm making create new files that ought to be added to the excluded files. I can easily add them to my .git/info/exclude file but it's much more work for me and others to spread those changes. Is there any reas

Re: [HACKERS] Add .gitignore files to CVS?

2010-01-07 Thread Tim Bunce
On Thu, Jan 07, 2010 at 05:45:08PM -0500, Tom Lane wrote: > Peter Eisentraut writes: > > On tor, 2010-01-07 at 22:16 +0000, Tim Bunce wrote: > >> Is there any reason not to add .gitignore files into the repository? > > > I already find the .cvsignore files to be

[HACKERS] Initial refactoring of plperl.c - updated

2010-01-08 Thread Tim Bunce
On Mon, Jan 04, 2010 at 06:38:03PM -0500, Andrew Dunstan wrote: > Andrew Dunstan wrote: > >> > >>Yes. I believe the test is highlighting an existing problem: that plperl > >>function in non-PG_UTF8 databases can't use regular expressions that > >>require unicode character meta-data. > >> > >>Either

Re: [HACKERS] Initial refactoring of plperl.c - updated

2010-01-09 Thread Tim Bunce
On Fri, Jan 08, 2010 at 09:47:01PM -0500, Andrew Dunstan wrote: > Tim Bunce wrote: > > > >I see you've not commited it yet, so to help out I've attached > >a new diff, over the current CVS head, with two minor changes: > > > >- Removed the test, as noted

Re: [HACKERS] Feature patch 1 for plperl [PATCH]

2010-01-09 Thread Tim Bunce
On Fri, Jan 08, 2010 at 10:36:43PM -0500, Robert Haas wrote: > On Fri, Jan 8, 2010 at 10:01 AM, Tim Bunce wrote: > > I didn't get any significant feedback from the earlier draft so here's > > the finished 'feature patch 1' for plperl.  (This builds on my earlie

Re: [HACKERS] mailing list archiver chewing patches

2010-01-09 Thread Tim Bunce
On Sat, Jan 09, 2010 at 02:17:27AM -0300, Alvaro Herrera wrote: > Alvaro Herrera wrote: > > Andrew Dunstan wrote: > > > > > > Tim Bunce's recent patch has been mangled apparently by the list > > > archives. He sent it as an attachment, and that's how I have it in > > > my mailbox, so why isn't it

Re: [HACKERS] Initial refactoring of plperl.c - updated

2010-01-09 Thread Tim Bunce
On Sat, Jan 09, 2010 at 11:16:18PM +0200, Peter Eisentraut wrote: > On fre, 2010-01-08 at 12:46 +0000, Tim Bunce wrote: > > *** 45,50 > > --- 45,55 > > > > include $(top_srcdir)/src/Makefile.shlib > > > > + plperl.o: perlchunk

Re: [HACKERS] Initial refactoring of plperl.c - updated

2010-01-09 Thread Tim Bunce
On Sat, Jan 09, 2010 at 11:49:22PM +, Tim Bunce wrote: > On Sat, Jan 09, 2010 at 11:16:18PM +0200, Peter Eisentraut wrote: > > On fre, 2010-01-08 at 12:46 +0000, Tim Bunce wrote: > > > *** 45,50 > > > --- 45,55 > > > > > &g

Re: [HACKERS] Initial refactoring of plperl.c - updated

2010-01-10 Thread Tim Bunce
On Sun, Jan 10, 2010 at 01:16:13AM -0500, Tom Lane wrote: > Tim Bunce writes: > > On Sat, Jan 09, 2010 at 11:16:18PM +0200, Peter Eisentraut wrote: > >> What's the reason for the temp file here? > > > Defensive. If the text2macro.pl program fails/dies then you&#x

[HACKERS] Feature patch 1 for plperl - open issues

2010-01-11 Thread Tim Bunce
Thanks for all the feedback! I'm going to try to summarize and address the issues raised. (Meanwhile I've started spliting the patch into at least three parts, per Andrew's suggestion: utility functions, the GUCs, the rest.) * Long GUC values I think the underlying assumption that they'll be l

Re: [HACKERS] Feature patch 1 for plperl [PATCH]

2010-01-13 Thread Tim Bunce
On Tue, Jan 12, 2010 at 07:06:59PM -0500, Robert Haas wrote: > On Sun, Jan 10, 2010 at 4:35 PM, Robert Haas wrote: > >>> I would strongly suggest to Tim that he rip the portions of this patch > >>> that are related to this feature out and submit them separately so > >>> that we can commit the unco

[HACKERS] Add utility functions to plperl [PATCH]

2010-01-13 Thread Tim Bunce
This is the first of the patches to be split out from the former 'plperl feature patch 1'. Changes in this patch: - Added utility functions: quote_literal, quote_nullable, quote_ident, encode_bytea, decode_bytea, looks_like_number, encode_array_literal, encode_array_constructor. - Stored

[HACKERS] Miscellaneous changes to plperl [PATCH]

2010-01-14 Thread Tim Bunce
This is the second of the patches to be split out from the former 'plperl feature patch 1'. Changes in this patch: - Allow (ineffective) use of 'require' in plperl If the required module is not already loaded then it dies. So "use strict;" now works in plperl. - Pre-load the feature modu

Re: [HACKERS] Miscellaneous changes to plperl [PATCH]

2010-01-14 Thread Tim Bunce
On Thu, Jan 14, 2010 at 09:34:42AM -0800, David E. Wheeler wrote: > On Jan 14, 2010, at 8:07 AM, Tim Bunce wrote: > > > - Stored procedure subs are now given names. > >The names are not visible in ordinary use, but they make > >tools like Devel::NYTProf and Devel::

[HACKERS] Add on_perl_init and proper destruction to plperl [PATCH]

2010-01-14 Thread Tim Bunce
This is the third of the patches to be split out from the former 'plperl feature patch 1'. Changes in this patch: - Added plperl.on_perl_init GUC for DBA use (PGC_SIGHUP) SPI functions are not available when the code is run. - Added normal interpreter destruction behaviour END blocks, if

[HACKERS] Add on_trusted_init and on_untrusted_init to plperl [PATCH]

2010-01-14 Thread Tim Bunce
This is the fourth of the patches to be split out from the former 'plperl feature patch 1'. Changes in this patch: - Adds plperl.on_trusted_init and plperl.on_untrusted_init GUCs Both are PGC_USERSET. SPI functions are not available when the code is run. Errors are detected and report

[HACKERS] Package namespace and Safe init cleanup for plperl [PATCH]

2010-01-14 Thread Tim Bunce
This is the final plperl patch in the series from me. Changes in this patch: - Moved internal functions out of main:: namespace into PostgreSQL::InServer and PostgreSQL::InServer::safe - Restructured Safe compartment setup code to generalize and separate the data from the logic. Neither

[HACKERS] Helping the CommitFest re PL/Perl changes

2010-01-19 Thread Tim Bunce
What can I do to help the CommitFest, especially in relation to the PL/Perl changes? Tim. p.s. I've sent an email to the dbi-users and dbi-announce lists http://www.mail-archive.com/dbi-us...@perl.org/msg32649.html in the hope of encouraging some more people to review and test the patches, and ho

Re: [HACKERS] warn in plperl logs as... NOTICE??

2010-01-22 Thread Tim Bunce
On Thu, Jan 21, 2010 at 07:55:09PM -0500, Andrew Dunstan wrote: > Tom Lane wrote: > >Andrew Dunstan writes: > >>Jim Nasby wrote: > >>>Why does warn; in plperl log as NOTICE in Postgres? > > > >>Where would you like the warning to go? This has been this way > >>for nearly 5 years, it's not new (and

Re: [HACKERS] Miscellaneous changes to plperl [PATCH]

2010-01-23 Thread Tim Bunce
On Fri, Jan 22, 2010 at 08:59:10PM -0700, Alex Hunsaker wrote: > On Thu, Jan 14, 2010 at 09:07, Tim Bunce wrote: > > - Allow (ineffective) use of 'require' in plperl > >    If the required module is not already loaded then it dies. > >    So "use strict;"

Re: [HACKERS] Miscellaneous changes to plperl [PATCH]

2010-01-25 Thread Tim Bunce
On Sat, Jan 23, 2010 at 06:40:03PM -0700, Alex Hunsaker wrote: > On Sat, Jan 23, 2010 at 16:16, Tim Bunce wrote: > > On Fri, Jan 22, 2010 at 08:59:10PM -0700, Alex Hunsaker wrote: > >> On Thu, Jan 14, 2010 at 09:07, Tim Bunce wrote: > >> I'd vote for use warni

Re: [HACKERS] Miscellaneous changes to plperl [PATCH]

2010-01-25 Thread Tim Bunce
On Mon, Jan 25, 2010 at 11:09:12AM -0500, Andrew Dunstan wrote: > > Tim Bunce wrote: > > > >FYI I've an updated patch ready but I'll wait till the commitfest has > >got 'closer' as there's a fair chance a further update will be needed > >anyw

Re: [HACKERS] Package namespace and Safe init cleanup for plperl [PATCH]

2010-01-25 Thread Tim Bunce
On Fri, Jan 15, 2010 at 04:02:02AM +, Tim Bunce wrote: > This is the final plperl patch in the series from me. > > Changes in this patch: > > - Moved internal functions out of main:: namespace > into PostgreSQL::InServer and PostgreSQL::InServer::safe > > - Restr

Re: [HACKERS] Add on_perl_init and proper destruction to plperl [PATCH]

2010-01-27 Thread Tim Bunce
On Wed, Jan 27, 2010 at 12:46:42AM -0700, Alex Hunsaker wrote: > On Tue, Jan 26, 2010 at 23:14, Tom Lane wrote: > > Andrew Dunstan writes: > >> Tim Bunce wrote: > >>> - Added plperl.on_perl_init GUC for DBA use (PGC_SIGHUP) > >>> SPI functi

  1   2   >