From 6afe828ed533f558bef5be19ae4d0ae71575cfc6 Mon Sep 17 00:00:00 2001 From: Julien Rouhaud Date: Sun, 27 May 2018 02:51:05 +0200 Subject: [PATCH] Fix support for pg11. WRT upstream commit 8224de4f42c. For now, explicitly disallow INCLUDE clause for hypothetical index and have set the nkeycolumns equal to ncolumns. A following commit will add proper support for the pg11 INCLUDE feature. --- hypopg.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hypopg.c b/hypopg.c index fc51eb0..6ac861b 100644 --- a/hypopg.c +++ b/hypopg.c @@ -546,6 +546,11 @@ hypo_entry_store_parsetree(IndexStmt *node, const char *queryString) elog(ERROR, "hypopg: cannot use more thant %d columns in an index", INDEX_MAX_KEYS); +#if PG_VERSION_NUM >= 110000 + if (node->indexIncludingParams) + elog(ERROR, "hypopg: INCLUDE clause is not yet supported."); +#endif + initStringInfo(&indexRelationName); appendStringInfo(&indexRelationName, "%s", node->accessMethod); appendStringInfo(&indexRelationName, "_"); @@ -1149,6 +1154,10 @@ hypo_injectHypotheticalIndex(PlannerInfo *root, * relation, TODO */ index->rel = rel; index->ncolumns = ncolumns = entry->ncolumns; +#if PG_VERSION_NUM >= 110000 + /* FIXME change this when support for INCLUDE will be added */ + index->nkeycolumns = ncolumns = entry->ncolumns; +#endif index->indexkeys = (int *) palloc(sizeof(int) * ncolumns); index->indexcollations = (Oid *) palloc(sizeof(int) * ncolumns);