pgpool2.git / summary / log / commit / refs
commit 6f6f0bef4fd704b89c85543635753db21eac62a3
Author: Yugo Nagata <nagata@sraoss.co.jp>
Date: Thu Oct 15 02:48:08 2015 +0000
Fix segfalut that occurs when function is used in FROM clause
When a function is used in FROM, the parser makes a RangeFunction
node whose functions member is a list whose last element is NIL.
This caused segfault in foreach loop in _outListWith().
PRPARE statements in streaming-reaplication mode and INSERT/UPDATE
with SELECT in native-replication mode were affected. For example:
- prepare p as select * from generate_series(1,1);
- insert into tbl select now(), * from generate_series(1,1);
src/parser/outfuncs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/parser/outfuncs.c b/src/parser/outfuncs.c
index 6d702c5fc..417cb2cf0 100644
--- a/src/parser/outfuncs.c
+++ b/src/parser/outfuncs.c
@@ -290,7 +290,7 @@ static void _outListWith(String *str, List *node, char *op)
first = 1;
else
{
- if (!IsA(lfirst(lc), A_Indices))
+ if (lfirst(lc) != NIL && !IsA(lfirst(lc), A_Indices))
string_append_char(str, op);
}
_outNode(str, lfirst(lc));
[parent: 009c48123c8c]