Re: Increase pltcl test coverage
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jim Nasby <Jim.Nasby@bluetreble.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>,
Karl Lehenbauer <karl@flightaware.com>
Date: 2017-01-08T17:25:07Z
Lists: pgsql-hackers
Jim Nasby <Jim.Nasby@bluetreble.com> writes:
> On 1/6/17 2:17 PM, Tom Lane wrote:
>> This is in a format that neither patch(1) nor "git apply" recognize.
>> Please resubmit in a more usual format, diff -c or diff -u perhaps.
> Odd, dunno what happened there. New patch attached.
This applies, but I fail to get the expected regression test output:
*** /home/postgres/pgsql/src/pl/tcl/expected/pltcl_queries.out Sun Jan 8 11:54:19 2017
--- /home/postgres/pgsql/src/pl/tcl/results/pltcl_queries.out Sun Jan 8 12:18:27 2017
***************
*** 515,529 ****
select tcl_eval('spi_prepare a "b {"');
ERROR: unmatched open brace in list
select tcl_error_handling_test($tcl${ spi_prepare "moo" }$tcl$);
! tcl_error_handling_test
! ------------------------------
! COMMAND: spi_prepare "moo" +
! POSTGRES: 'POSTGRES' +
! TCL: LOOKUP +
! funcname: 'funcname' +
! lineno: 'lineno'
! (1 row)
!
-- test full error text
select tcl_error_handling_test($tcl$
spi_exec "DO $$
--- 515,521 ----
select tcl_eval('spi_prepare a "b {"');
ERROR: unmatched open brace in list
select tcl_error_handling_test($tcl${ spi_prepare "moo" }$tcl$);
! ERROR: list must have an even number of elements
-- test full error text
select tcl_error_handling_test($tcl$
spi_exec "DO $$
Investigation shows that $::errorCode contains just "NONE", which
is why the "array set myArray $::errorCode" is blowing up. And
that's sort of what I'd expect, because $err is
invalid command name " spi_prepare "moo" "
which is not a Postgres-detected error. So probably the example
tcl_error_handling_test function should not dispense with the
if {[lindex $::errorCode 0] == "POSTGRES"}
guard that we recommend in the manual. But I don't understand
how you got the sample output shown in the patch. Is this based
on some unsubmitted changes in pltcl's error handling?
regards, tom lane
Commits
-
Expand the regression tests for PL/Tcl.
- 961bed020891 10.0 landed