Fix logical errors in tsquery selectivity estimation for prefix queries.
Fix logical errors in tsquery selectivity estimation for prefix queries.

I made multiple errors in commit 97532f7c29468010b87e40a04f8daa3eb097f654,
stemming mostly from failure to think about the available frequency data
as being element frequencies not value frequencies (so that occurrences of
different elements are not mutually exclusive).  This led to sillinesses
such as estimating that "word" would match more rows than "word:*".

The choice to clamp to a minimum estimate of DEFAULT_TS_MATCH_SEL also
seems pretty ill-considered in hindsight, as it would frequently result in
an estimate much larger than the available data suggests.  We do need some
sort of clamp, since a pattern not matching any of the MCELEMs probably
still needs a selectivity estimate of more than zero.  I chose instead to
clamp to at least what a non-MCELEM word would be estimated as, preserving
the property that "word:*" doesn't get an estimate less than plain "word",
whether or not the word appears in MCELEM.

Per investigation of a gripe from Bill Martin, though I suspect that his
example case actually isn't even reaching the erroneous code.

Back-patch to 9.1 where this code was introduced.

oberstet/postgres-xl,50wu/gpdb,lisakowen/gpdb,50wu/gpdb,ashwinstar/gpdb,lisakowen/gpdb,jmcatamney/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,zeroae/postgres-xl,Postgres-XL/Postgres-XL,pavanvd/postgres-xl,ashwinstar/gpdb,50wu/gpdb,50wu/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,adam8157/gpdb,lisakowen/gpdb,oberstet/postgres-xl,yazun/postgres-xl,ovr/postgres-xl,ovr/postgres-xl,adam8157/gpdb,ashwinstar/gpdb,oberstet/postgres-xl,adam8157/gpdb,xinzweb/gpdb,Postgres-XL/Postgres-XL,greenplum-db/gpdb,lisakowen/gpdb,yazun/postgres-xl,pavanvd/postgres-xl,oberstet/postgres-xl,xinzweb/gpdb,ovr/postgres-xl,50wu/gpdb,Postgres-XL/Postgres-XL,zeroae/postgres-xl,greenplum-db/gpdb,jmcatamney/gpdb,zeroae/postgres-xl,techdragon/Postgres-XL,Postgres-XL/Postgres-XL,xinzweb/gpdb,jmcatamney/gpdb,adam8157/gpdb,jmcatamney/gpdb,zeroae/postgres-xl,ovr/postgres-xl,lisakowen/gpdb,yazun/postgres-xl,Postgres-XL/Postgres-XL,adam8157/gpdb,pavanvd/postgres-xl,xinzweb/gpdb,ashwinstar/gpdb,yazun/postgres-xl,xinzweb/gpdb,yazun/postgres-xl,ashwinstar/gpdb,zeroae/postgres-xl,50wu/gpdb,ovr/postgres-xl,lisakowen/gpdb,greenplum-db/gpdb,lisakowen/gpdb,greenplum-db/gpdb,xinzweb/gpdb,techdragon/Postgres-XL,ashwinstar/gpdb,pavanvd/postgres-xl,pavanvd/postgres-xl,oberstet/postgres-xl,greenplum-db/gpdb,techdragon/Postgres-XL,ashwinstar/gpdb,adam8157/gpdb,greenplum-db/gpdb,techdragon/Postgres-XL,50wu/gpdb,jmcatamney/gpdb,adam8157/gpdb,greenplum-db/gpdb,xinzweb/gpdb,lisakowen/gpdb,techdragon/Postgres-XL,50wu/gpdb,xinzweb/gpdb,adam8157/gpdb,jmcatamney/gpdb