Trying to create an hypothetical index with an INCLUDE clause on pg10- will
obviously fail with a syntax error.
Also add regression test for the INCLUDE clause on btree indexes.
To avoid locking on pg_class (required to safely call GetNewOidWithIndex or
similar) and to be usable on a standby node, use the oids unused in the
FirstBootstrapObjectId / FirstNormalObjectId range rather than real oids. For
performance, always start with the biggest oid lesser than FirstNormalObjectId.
This way the loop to find an unused oid will only happens once a single backend
has created more than ~2.5k hypothetical indexes.
For people needing to have thousands of hypothetical indexes at the same time,
we also allow to use the initial implementation that relies on real oids, which
comes with all the limitations mentioned above, with the new
hypopg.use_real_oids GUC.
This will be helpful in a following patch. The immediate effect is to fix a
long standing small performance issue, as hypo_explain_get_index_name_hook
didn't stop its loop once it found a matching entry.
* Add PGDLLEXPORT to functions called externally
* Make it compile with Visual Studio (it doesn't support #ifdef in macros)
* Add explicit type-cast so silence compiler warnings.
* Replace {INT_MAX | INT32_MAX } with PG_INT32_MAX
(cherry picked from commit 4a5dc56169)