Thanks! I think we're almost there. I will send you my version via email which has a few changes:
The URLs for the context markers include the current page number. However, if you click on a context marker (say, the letter "C") and that context has fewer pages than your current page (in say the "ALL" context), you will get a blank list. So, for generating context markers, I changed the call to build_url to exclude the ${name}_page variable.
The "-query" parameter to "tools::paginate" wasn't working properly (-queryname works fine). The problem was it calls:
But, at the template parse level, get_record_count_dynamic doesn't exist in any *.xql files. So, I changed this to do a db_map and then pass the query string directly to the uplevel'ed db_string call.
Made minor changes to the tools-*.xql files in support of the above changes.
The offset in tools-postgresql.xql should be [expr $start - 1], not $start (eg, if $start is the 11th, then you want to set the offset to 10 so that PG skips the first 10 records).
Your sample "index.tcl" file includes a call to "lset" which I think is a jongriffin.com(TM) Tcl proc. Perhaps change it to standard Tcl so folks don't trip on it and give up before they get to see how darn cool your paginator is. =)