pgsql: Tidy up and refactor plperl.c.

Lists: pgsql-committerspgsql-hackers
From: adunstan(at)postgresql(dot)org (Andrew Dunstan)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Tidy up and refactor plperl.c.
Date: 2010-01-09 02:40:50
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Log Message:
-----------
Tidy up and refactor plperl.c.

- Changed MULTIPLICITY check from runtime to compiletime.
No loads the large Config module.
- Changed plperl_init_interp() to return new interp
and not alter the global interp_state
- Moved plperl_safe_init() call into check_interp().
- Removed plperl_safe_init_done state variable
as interp_state now covers that role.
- Changed plperl_create_sub() to take a plperl_proc_desc argument.
- Simplified return value handling in plperl_create_sub.
- Changed perl.com link in the docs to perl.org and tweaked
wording to clarify that require, not use, is what's blocked.
- Moved perl code in large multi-line C string literal macros
out to plc_*.pl files.
- Added a test2macro.pl utility to convert the plc_*.pl files to
macros in a perlchunks.h file which is #included
- Simplifed plperl_safe_init() slightly
- Optimized pg_verifymbstr calls to avoid unneeded strlen()s.

Patch from Tim Bunce, with minor editing from me.

Modified Files:
--------------
pgsql/doc/src/sgml:
plperl.sgml (r2.71 -> r2.72)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/plperl.sgml?r1=2.71&r2=2.72)
pgsql/src/pl/plperl:
GNUmakefile (r1.37 -> r1.38)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/pl/plperl/GNUmakefile?r1=1.37&r2=1.38)
plperl.c (r1.158 -> r1.159)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/pl/plperl/plperl.c?r1=1.158&r2=1.159)
pgsql/src/pl/plperl/sql:
plperl.sql (r1.14 -> r1.15)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/pl/plperl/sql/plperl.sql?r1=1.14&r2=1.15)

Added Files:
-----------
pgsql/src/pl/plperl:
plc_perlboot.pl (r1.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/pl/plperl/plc_perlboot.pl?rev=1.1&content-type=text/x-cvsweb-markup)
plc_safe_bad.pl (r1.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/pl/plperl/plc_safe_bad.pl?rev=1.1&content-type=text/x-cvsweb-markup)
plc_safe_ok.pl (r1.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/pl/plperl/plc_safe_ok.pl?rev=1.1&content-type=text/x-cvsweb-markup)
text2macro.pl (r1.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/pl/plperl/text2macro.pl?rev=1.1&content-type=text/x-cvsweb-markup)


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Tidy up and refactor plperl.c.
Date: 2010-01-09 03:25:11
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

adunstan(at)postgresql(dot)org (Andrew Dunstan) writes:
> - Changed MULTIPLICITY check from runtime to compiletime.
> No loads the large Config module.

[ squint... ] I thought we'd decided that wasn't a good idea?
What happens if the libperl we load at runtime doesn't match what
we saw in the headers?

regards, tom lane


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Tidy up and refactor plperl.c.
Date: 2010-01-09 03:29:07
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

On Fri, Jan 8, 2010 at 10:25 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> adunstan(at)postgresql(dot)org (Andrew Dunstan) writes:
>> - Changed MULTIPLICITY check from runtime to compiletime.
>>     No loads the large Config module.
>
> [ squint... ]  I thought we'd decided that wasn't a good idea?
> What happens if the libperl we load at runtime doesn't match what
> we saw in the headers?

See:

http://archives.postgresql.org/pgsql-hackers/2009-11/msg01941.php

...Robert


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Tidy up and refactor plperl.c.
Date: 2010-01-09 03:31:21
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Fri, Jan 8, 2010 at 10:25 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> [ squint... ] I thought we'd decided that wasn't a good idea?

> http://archives.postgresql.org/pgsql-hackers/2009-11/msg01941.php

OK, I'd forgotten that ...

regards, tom lane


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Tidy up and refactor plperl.c.
Date: 2010-01-09 14:19:44
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers


This has broken MSVC builds - I am working on it.

cheers

andrew