bitnine-oss / agensgraph

AgensGraph, a transactional graph database based on PostgreSQL
http://www.agensgraph.org
Other
1.34k stars 149 forks source link

fix: LIMIT clause causes VLEs [*] to crash (AG-254) #486

Closed jrgemignani closed 5 years ago

jrgemignani commented 5 years ago

This fix is to correct issue AG-254 which is due to how Postgres implements the LIMIT clause - basically, terminating a query in progress once it receives the requested number of rows from it.

The ExecEndNestLoopVLE function, which deals with cleanup for the VLE nested loop, was not cleaning up its internal context stack. This caused, in some cases, the index routines to improperly free the contexts, sometimes attempting to free them twice.

The fix is to properly unwind the context stack. The following was done to correct the issue -

Additionally, regression tests were modified to include tests for this fix -

Note: This fix compiles and passes all install checks.

-jrg