diff options
| author | Yugo Nagata | 2015-10-15 02:48:08 +0000 |
|---|---|---|
| committer | Yugo Nagata | 2015-10-15 03:04:20 +0000 |
| commit | 6f6f0bef4fd704b89c85543635753db21eac62a3 (patch) | |
| tree | 7b0cc0657cdcaa028669051d74bf51c8109cda54 /src/parser/outfuncs.c | |
| parent | 009c48123c8c7060eb5648526b567086633e724b (diff) | |
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);
Diffstat (limited to 'src/parser/outfuncs.c')
| -rw-r--r-- | src/parser/outfuncs.c | 2 |
1 files changed, 1 insertions, 1 deletions
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)); |
