Re: Increase pltcl test coverage

Jim Nasby <jim.nasby@bluetreble.com>

From: Jim Nasby <Jim.Nasby@BlueTreble.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>, Karl Lehenbauer <karl@flightaware.com>
Date: 2017-01-09T00:21:36Z
Lists: pgsql-hackers

Attachments

On 1/8/17 11:25 AM, Tom Lane wrote:
> 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?

AFAICT you've got everything. What I had on my end is:

create function public.tcl_error_handling_test(text)
  returns text
  language pltcl
as $function$
     if {[catch $1 err]} {
		# Set keys that will change over time to fixed values
		array set myArray $::errorCode
		set myArray(funcname) "'funcname'"
		set myArray(lineno) 'lineno'
		set myArray(POSTGRES) 'POSTGRES'

		# Format into something nicer
		set vals []
		foreach {key} [lsort [array names myArray]] {
			set value [string map {"\n" "\n\t"} $myArray($key)]
			lappend vals "$key: $value"
		}
		return [join $vals "\n"]
     } else {
         return "no error"
     }
$function$
;

Maybe it's a version difference?

echo 'puts [info patchlevel];exit 0' | tclsh
8.6.6

Anyway, attached is a complete new patch that fixes that issue (and a 
couple test diffs I missed :/), as well as the utf_e2u issue you 
discovered. I've applied this patch to master via git apply and run it 
through make check-world, so hopefully this puts the horse out to pasture.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)

Commits

  1. Expand the regression tests for PL/Tcl.