Re: pltcl crashes due to a syntax error

2024-06-04 Thread Tom Lane
Erik Wienhold writes: > On 2024-06-03 18:57 +0200, Tom Lane wrote: >> So your thought that we should just not use throw_tcl_error here >> was correct, and a minimal fix could look like the attached. > LGTM. Pushed, thanks. regards, tom lane

Re: pltcl crashes due to a syntax error

2024-06-03 Thread Erik Wienhold
On 2024-06-03 18:57 +0200, Tom Lane wrote: > Erik Wienhold writes: > > On 2024-06-03 00:15 +0200, Tom Lane wrote: > >> 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 m

Re: pltcl crashes due to a syntax error

2024-06-03 Thread Tom Lane
Erik Wienhold writes: > On 2024-06-03 00:15 +0200, Tom Lane wrote: >> 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 h

Re: pltcl crashes due to a syntax error

2024-06-03 Thread Erik Wienhold
On 2024-06-03 00:15 +0200, Tom Lane wrote: > 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

Re: pltcl crashes due to a syntax error

2024-06-02 Thread Tom Lane
Erik Wienhold 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. T

Re: pltcl crashes due to a syntax error

2024-06-02 Thread Erik Wienhold
On 2024-06-02 14:32 +0200, Pierre Forstmann wrote: > I understand that Tcl_GetVar should not be used any more and should be > replaced by Tcl_GetStringResult > (but I know nothing about Tcl internals) > > Following patch : > diff postgres/src/pl/tcl/pltcl.c.orig postgres/src/pl/tcl/pltcl.c > 1373c

Re: pltcl crashes due to a syntax error

2024-06-02 Thread Pierre Forstmann
I can also reproduce in Alma Linux 8.10 with tcl-devel 8.6.8 gdb says: (gdb) p interp $1 = (Tcl_Interp *) 0x288a500 (gdb) p *interp $2 = {resultDontUse = 0x288a6d8 "", freeProcDontUse = 0x0, errorLineDontUse = 1} (gdb) p msg No symbol "msg" in current context. (gdb) p emsg $3 = 0x27ebe48 "list

Re: pltcl crashes due to a syntax error

2024-06-01 Thread Tom Lane
"a.kozhemyakin" writes: > When executing the following query on master branch: > CREATE EXTENSION pltcl; > CREATE or replace PROCEDURE test_proc5(INOUT a text) >     LANGUAGE pltcl >     AS $$ >     set aa [concat $1 "+" $1] >     return [list $aa $aa]) >     $$; > CALL