mirror of
https://github.com/HypoPG/hypopg
synced 2026-05-24 09:38:21 +00:00
Fix segfault when an expression is used.
If an expression is used, just don't create an hypothetical index. An index on the remaining columns could be built, but it would not be intuitive, and it may not remain any column left. Thanks Thom Brown for reporting it.
This commit is contained in:
parent
87e7478376
commit
b6baf06b67
1 changed files with 22 additions and 0 deletions
22
hypopg.c
22
hypopg.c
|
|
@ -390,8 +390,30 @@ entry_store_parsetree(IndexStmt *node)
|
|||
int ncolumns;
|
||||
ListCell *lc;
|
||||
int j;
|
||||
bool ok = true;
|
||||
|
||||
|
||||
/* check first if there's an expression.
|
||||
* the column list will probably be checked twice, but it avoids the need
|
||||
* to worry about freeing memory later.
|
||||
*/
|
||||
foreach(lc, node->indexParams)
|
||||
{
|
||||
IndexElem *indexelem = (IndexElem *) lfirst(lc);
|
||||
|
||||
if (indexelem->expr != NULL)
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
elog(WARNING, "hypopg: hypothetical indexes on expression are not supported yet");
|
||||
return false;
|
||||
}
|
||||
|
||||
ncolumns = list_length(node->indexParams);
|
||||
|
||||
initStringInfo(&indexRelationName);
|
||||
|
|
|
|||
Loading…
Reference in a new issue