Re: pltcl crashes due to a syntax error - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pltcl crashes due to a syntax error
Date
Msg-id 2365308.1717366548@sss.pgh.pa.us
Whole thread Raw
In response to Re: pltcl crashes due to a syntax error  (Erik Wienhold <ewie@ewie.name>)
Responses Re: pltcl crashes due to a syntax error
List pgsql-hackers
Erik Wienhold <ewie@ewie.name> writes:
> Tcl_GetVar returns null if errorInfo does not exist.  Omitting econtext
> from errcontext in that case looks like the proper fix to me.

Yeah, that was the conclusion I came to last night while sitting in
the airport, but I didn't have time to prepare a cleaned-up patch.

The new bit of information that this bug report provides is that it's
possible to get a TCL_ERROR result without Tcl having set errorInfo.
That seems a tad odd, and it must happen only in weird corner cases,
else we'd have heard of this decades ago.  Not sure if it's worth
trying to characterize those cases further, however.

> Or just do away with throw_tcl_error and call ereport directly.

I'd say this adds to the importance of having throw_tcl_error,
because now it's even more complex than before, and there are
multiple call sites.

> Compare
> that to pltcl_trigger_handler where the same case is handled like this:

Hm, I wonder why that's not using throw_tcl_error.  I guess because
it wants to give its own primary message, but still ...

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Schema variables - new implementation for Postgres 15
Next
From: Joseph Koshakow
Date:
Subject: Re: Fix overflow hazard in interval rounding