Menu

#2 SelectStmt are not always correctly identified as Certain

open
nobody
None
5
2014-08-24
2012-02-23
No

SelectStmt containing a larg and rarg as a result of a union could contain uncertainty. However, this uncertainty is not taken into account by the process_select function. In order to resulve this problem:

=== rewrite.c ===
==== process_subquery(SelectStmt *sel) ====
sel->larg = process_select(sel->larg);
sel->rarg = process_select(sel->rarg);
/** ADD */
if (sel->larg->tabletype == TABLETYPE_URELATION || sel->rarg->tabletype == TABLETYPE_URELATION) {
sel->tabletype = TABLETYPE_URELATION;
}
/** ADD */

==== process_select(SelectStmt *sel) ====
if(all_relations_are_certain(list_length(result->fromClause), typeArray) || isCertainSel)
{
/** CHANGED */
if (result->tabletype != TABLETYPE_URELATION ) {
/* Set the tag */
result->tabletype = TABLETYPE_CERTAIN;
}
/** END CHANGED */
}

Discussion


Log in to post a comment.

MongoDB Logo MongoDB
Gen AI apps are built with MongoDB Atlas
Atlas offers built-in vector search and global availability across 125+ regions. Start building AI apps faster, all in one place.