Re: [COMMITTERS] pgsql: Add traceback information to PL/Python errors

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Add traceback information to PL/Python errors
Date: 2011-04-07 21:01:41
Message-ID: BANLkTim5_8wKea8QW1UqShjuEVphV1E_Zw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Wed, Apr 6, 2011 at 3:37 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> Add traceback information to PL/Python errors
>
> This mimics the traceback information the Python interpreter prints
> with exceptions.
>
> Jan Urbański

On my system this spits out a warning:

plpython.c: In function ‘PLy_traceback’:
plpython.c:4487: warning: ‘s’ may be used uninitialized in this function
plpython.c:4487: note: ‘s’ was declared here

That appears to be a live bug, unless it's guaranteed that lineno will
always be > 0.

Also, the loop test should really be written as current < lineno,
rather than current != lineno, just in case we should manage to pass a
lineno < 0, which with the current code would go into the tank and
spin.

This part looks pretty sketchy, too:

while (s && isspace((unsigned char) *s))
s++;

Perhaps we meant to test *s here. It's hard to believe that we're
really intending to test whether the pointer has fallen off the end of
the address space and wrapped around to NULL.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Jan Urbański 2011-04-07 21:06:38 Re: [COMMITTERS] pgsql: Add traceback information to PL/Python errors
Previous Message Robert Haas 2011-04-07 20:48:36 pgsql: Tweaks for SSI out-of-shared memory behavior.

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-04-07 21:03:12 Re: pg_upgrade automatic testing
Previous Message Jeff Davis 2011-04-07 20:57:12 Re: pg_upgrade bug found!