Fix syntax error in native replication, when queries including now() etc. and "IN...
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:31 +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 2630086cda440ada5bf1b34b2f706e77b2fd5247..424aad44f72216121cb1a01d4c8507f73dedae9d 100644 (file)
@@ -460,6 +460,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);