proc PGglobals {} {

#	once you have a connect, you need to figure out
#	a few things before getting started.  To begin
#	with, you need a table of data type oids to
#	data type names and sizes
#

	global PGtypes Pgtypids PGusers PGuids

	set typtbl pg_type
	set usrtbl pg_user

	set sqlcmd "select $typtbl.oid, $typtbl.* from $typtbl"
	set sqt $typtbl
	lassign [pgSQL 1] ct han res
	set atts [pgCols $han]
	foreach a $atts {
		lappend cols [lindex $a 0]
	}

	loop i 0 $ct {
		set line [pgGetI $han $i]
		eval lassign \$line $cols
		foreach c $cols {
			keylset PGtypes($oid) $c [set $c]
		}
		set PGtypids($typname) $oid
	}
	
#

	set cols ""
	set sqlcmd "select $usrtbl.oid,$usrtbl.* from $usrtbl"
	set sqt $usrtbl

	lassign [pgSQL 1] ct han res

	set atts [pgCols $han]
	foreach a $atts {
		lappend cols [lindex $a 0]
	}
#
	loop i 0 $ct {
		set line [pgGetI $han $i]
		eval lassign \$line $cols
		foreach c $cols {
			keylset PGusers($usesysid) $c [set $c]
		}
		set PGuids($usename) $usesysid
	}
#

	set ofp [open debug.out w]
	foreach a {PGtypes PGusers} {
	puts $ofp "\n\nArray $a:"
	foreach i [array names $a] {
	puts $ofp "  Elem $i :"
	foreach k [keylkeys ${a}($i)] {
		puts $ofp "    $k : [keylget ${a}($i) $k]"
	}
	}
	}
	close $ofp
}
