Re: Increase pltcl test coverage

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Karl Lehenbauer <karl(at)flightaware(dot)com>
Subject: Re: Increase pltcl test coverage
Date: 2017-01-08 17:25:07
Message-ID: 31179.1483896307@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2017-01-08 17:26:26 Re: [PATCH] guc-ify the formerly hard-coded MAX_SEND_SIZE to max_wal_send
Previous Message Joel Jacobson 2017-01-08 16:28:17 Re: RustgreSQL