Re: Another small pl/perl patch - Mailing list pgsql-patches

From Andrew Dunstan
Subject Re: Another small pl/perl patch
Date
Msg-id 435CFC18.5070503@dunslane.net
Whole thread Raw
In response to Re: Another small pl/perl patch  ("Greg Sabino Mullane" <greg@turnstep.com>)
List pgsql-patches

Greg Sabino Mullane wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>
>
>
>>Well, I personally almost always use indirect file handles rather than
>>globals. But I don't know that using globals file handles (which is what
>>I gather you are objecting to) is deprecated, is it? The perl docs are
>>absolutely littered with examples.
>>
>>
>
>No, my primary objection was using open() without checking the result.
>Everything else was icing. :)
>
>


I see. Well, given that it is meant to illustrate something that won't
run, I don't think that matters too much. But there is another error on
that page, where we state that the function will be created but fail to
run. In fact, now that we have a validator, it will not even be created:

andrew=# CREATE FUNCTION badfunc() RETURNS integer AS $$
andrew$#     open(TEMP, ">/tmp/badfile");
andrew$#     print TEMP "Gotcha!\n";
andrew$#     return 1;
andrew$# $$ LANGUAGE plperl;
ERROR:  creation of Perl function failed: 'open' trapped by operation
mask at line 2.
andrew=#



I'll make your change and fix the incorrect wording shortly.

cheers

andrew



pgsql-patches by date:

Previous
From: "Greg Sabino Mullane"
Date:
Subject: Re: Another small pl/perl patch
Next
From: Bruce Momjian
Date:
Subject: Re: [DOCS] Will PQregisterThreadLock() be documented?