Re: PL/Python import _sre module error

From: Gerhard Häring <lists(at)ghaering(dot)de>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: PL/Python import _sre module error
Date: 2003-06-16 20:39:53
Message-ID: 3EEE2B19.5070007@ghaering.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Glenn R Williams wrote:
> Hi All,
>
> Does anyone else have a problem with importing the re package
> I am using:
>
> Redhat 9.0
> PostgreSQL 7.3.3
> Python 2.2.2.26
>
> When I create a function:
>
> import re
> o = args[0]
> b = re.match(r"^t.*",o)
> if b:
> return "fits the bill"
> return "failed the test"
>
> PostgreSQL fails, and returns the error message:
>
> exceptions.ImportError: No module named _sre
>
> If I go into python, this is not a problem, so I suppose it is somehow
> due to the restricted execution environment and/or PostgreSQL. But
> that's as far as I get.

Correct. re is not enabled, because you can create arbitrary cpu (and
perhaps also memory) utilization with it. Thus it's unsafe.

> Any suggestions on how to pinpoint the problem? [...]

Fork pl/python and create an unsafe version without any restrictions?
That's what I once did just for fun. I think that'll be necessary
anyway, because with Python >= 2.2.3, rexec and friends are disabled anyway.

-- Gerhard

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Glenn R Williams 2003-06-16 22:45:35 Re: PL/Python import _sre module error
Previous Message Glenn R Williams 2003-06-16 20:34:49 PL/Python import _sre module error