Fix syntax error in native replication, when queries including now() etc. and "IN... origin/V3_4_STABLE
authorBo Peng <pengbo@sraoss.co.jp>
Thu, 18 Oct 2018 09:12:24 +0000 (18:12 +0900)
committerBo Peng <pengbo@sraoss.co.jp>
Thu, 18 Oct 2018 09:23:47 +0000 (18:23 +0900)
In native replication, queries including now() etc. are rewritten to a timestamp constant value.
However, Pgpool-II didn't support queries including now() etc. and "IN (SELECT ...)" in WHERE clause.

Per bug433.

src/parser/outfuncs.c

index 03e2b62c748804c14877522335395736011b985c..92d28023d677295e3a14a8361e3edb93c64150be 100644 (file)
@@ -416,6 +416,12 @@ _outSubLink(String *str, SubLink *node)
 {
        _outNode(str, node->testexpr);
 
+       /*
+        * If the source was "x IN (select)", convert to "x = ANY (select)".
+        */
+       if (node->subLinkType == ANY_SUBLINK && node->operName == NIL)
+               node->operName = list_make1(makeString("="));
+
        if (node->operName != NIL)
        {
                Value *v = linitial(node->operName);