(maint) Fix fact-node globbing tests

The regular expression I provided for the glob replace wasn't sufficient for
PostgreSQL to work. This patch amends it to be so.

I've also put in a test for keys with blank strings, to make sure this change
doesn't affect that case as well.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #1032 from kbarber/maint/master/fix-globbing-tests

(maint) Fix fact-node globbing tests
(PDB-763) Provide trgm index handling for fact_paths

This patch adds a detection routine outside of the normal migration that will
nag the user if they don't have pg_trgm installed (or don't have a compatible
system for trgm and regexp performance, ie. pg 9.3 or above).

If trgm is working, it will manage installing the correct index on the
fact_paths table for regular expression query optimization.

Without a trgm index, globbing and regular expression queries will not use
an index and thus those queries become full table scans.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #1033 from kbarber/ticket/master/pdb-763-trgm-indexing

(PDB-763) Provide trgm index handling for fact_paths
(PDB-772) Modify the facts endpoint to return structured facts

This pull request causes the v4 facts endpoint to return typed and structured
facts while leaving the v3 responses stringified as before.  It also adds a
"name" column to the fact_paths table representing the first element of a
fact's path.  This column should be renamed to "fact" in the future to avoid
confusion with the many references to 'certname' as name.
trying to fix offset; still broken
small items fixed
fixing paging
almost there
rebasing
changed query breaks postgres inequality