const char* tests[] = { "SELECT 1", "0", "{\"version\":170000,\"stmts\":[{\"stmt\":{\"SelectStmt\":{\"targetList\":[{\"ResTarget\":{\"val\":{\"A_Const\":{\"ival\":{\"ival\":1},\"location\":7}},\"location\":7}}],\"limitOption\":\"LIMIT_OPTION_DEFAULT\",\"op\":\"SETOP_NONE\"}}}]}", "integer", "1", "{\"version\":170000,\"stmts\":[{\"stmt\":{\"List\":{\"items\":[{\"String\":{\"sval\":\"pg_catalog\"}},{\"String\":{\"sval\":\"int4\"}}]}}}]}", "character varying(32)", "1", "{\"version\":170000,\"stmts\":[{\"stmt\":{\"List\":{\"items\":[{\"String\":{\"sval\":\"pg_catalog\"}},{\"String\":{\"sval\":\"varchar\"}}]}}}]}", "EXISTS(SELECT 1)", "2", "{\"version\":170000,\"stmts\":[{\"stmt\":{\"SelectStmt\":{\"targetList\":[{\"ResTarget\":{\"val\":{\"SubLink\":{\"subLinkType\":\"EXISTS_SUBLINK\",\"subselect\":{\"SelectStmt\":{\"targetList\":[{\"ResTarget\":{\"val\":{\"A_Const\":{\"ival\":{\"ival\":1},\"location\":14}},\"location\":14}}],\"limitOption\":\"LIMIT_OPTION_DEFAULT\",\"op\":\"SETOP_NONE\"}}}}}}],\"limitOption\":\"LIMIT_OPTION_DEFAULT\",\"op\":\"SETOP_NONE\"}}}]}", "v_version IS NULL", "2", "{\"version\":170000,\"stmts\":[{\"stmt\":{\"SelectStmt\":{\"targetList\":[{\"ResTarget\":{\"val\":{\"NullTest\":{\"arg\":{\"ColumnRef\":{\"fields\":[{\"String\":{\"sval\":\"v_version\"}}]}},\"nulltesttype\":\"IS_NULL\",\"location\":10}}}}],\"limitOption\":\"LIMIT_OPTION_DEFAULT\",\"op\":\"SETOP_NONE\"}}}]}", "pos:= instr($1, $2, 1)", "3", "{\"version\":170000,\"stmts\":[{\"stmt\":{\"PLAssignStmt\":{\"name\":\"pos\",\"nnames\":1,\"val\":{\"targetList\":[{\"ResTarget\":{\"val\":{\"FuncCall\":{\"funcname\":[{\"String\":{\"sval\":\"instr\"}}],\"args\":[{\"ParamRef\":{\"number\":1,\"location\":12}},{\"ParamRef\":{\"number\":2,\"location\":16}},{\"A_Const\":{\"ival\":{\"ival\":1},\"location\":20}}],\"funcformat\":\"COERCE_EXPLICIT_CALL\",\"location\":6}},\"location\":6}}],\"limitOption\":\"LIMIT_OPTION_DEFAULT\",\"op\":\"SETOP_NONE\"}}}}]}", "temp_str := substring(string FROM beg_index)", "3", "{\"version\":170000,\"stmts\":[{\"stmt\":{\"PLAssignStmt\":{\"name\":\"temp_str\",\"nnames\":1,\"val\":{\"targetList\":[{\"ResTarget\":{\"val\":{\"FuncCall\":{\"funcname\":[{\"String\":{\"sval\":\"pg_catalog\"}},{\"String\":{\"sval\":\"substring\"}}],\"args\":[{\"ColumnRef\":{\"fields\":[{\"String\":{\"sval\":\"string\"}}],\"location\":22}},{\"ColumnRef\":{\"fields\":[{\"String\":{\"sval\":\"beg_index\"}}],\"location\":34}}],\"funcformat\":\"COERCE_SQL_SYNTAX\",\"location\":12}},\"location\":12}}],\"limitOption\":\"LIMIT_OPTION_DEFAULT\",\"op\":\"SETOP_NONE\"}}}}]}", "v3.c1 := 4", "4", "{\"version\":170000,\"stmts\":[{\"stmt\":{\"PLAssignStmt\":{\"name\":\"v3\",\"indirection\":[{\"String\":{\"sval\":\"c1\"}}],\"nnames\":2,\"val\":{\"targetList\":[{\"ResTarget\":{\"val\":{\"A_Const\":{\"ival\":{\"ival\":4},\"location\":9}},\"location\":9}}],\"limitOption\":\"LIMIT_OPTION_DEFAULT\",\"op\":\"SETOP_NONE\"}}}}]}", "NEW.name = upper(cleanString(NEW.name))", "4", "{\"version\":170000,\"stmts\":[{\"stmt\":{\"PLAssignStmt\":{\"name\":\"new\",\"indirection\":[{\"String\":{\"sval\":\"name\"}}],\"nnames\":2,\"val\":{\"targetList\":[{\"ResTarget\":{\"val\":{\"FuncCall\":{\"funcname\":[{\"String\":{\"sval\":\"upper\"}}],\"args\":[{\"FuncCall\":{\"funcname\":[{\"String\":{\"sval\":\"cleanstring\"}}],\"args\":[{\"ColumnRef\":{\"fields\":[{\"String\":{\"sval\":\"new\"}},{\"String\":{\"sval\":\"name\"}}],\"location\":29}}],\"funcformat\":\"COERCE_EXPLICIT_CALL\",\"location\":17}}],\"funcformat\":\"COERCE_EXPLICIT_CALL\",\"location\":11}},\"location\":11}}],\"limitOption\":\"LIMIT_OPTION_DEFAULT\",\"op\":\"SETOP_NONE\"}}}}]}", "NEW.author.first_name = upper(cleanString(NEW.author.first_name))", "5", "{\"version\":170000,\"stmts\":[{\"stmt\":{\"PLAssignStmt\":{\"name\":\"new\",\"indirection\":[{\"String\":{\"sval\":\"author\"}},{\"String\":{\"sval\":\"first_name\"}}],\"nnames\":3,\"val\":{\"targetList\":[{\"ResTarget\":{\"val\":{\"FuncCall\":{\"funcname\":[{\"String\":{\"sval\":\"upper\"}}],\"args\":[{\"FuncCall\":{\"funcname\":[{\"String\":{\"sval\":\"cleanstring\"}}],\"args\":[{\"ColumnRef\":{\"fields\":[{\"String\":{\"sval\":\"new\"}},{\"String\":{\"sval\":\"author\"}},{\"String\":{\"sval\":\"first_name\"}}],\"location\":42}}],\"funcformat\":\"COERCE_EXPLICIT_CALL\",\"location\":30}}],\"funcformat\":\"COERCE_EXPLICIT_CALL\",\"location\":24}},\"location\":24}}],\"limitOption\":\"LIMIT_OPTION_DEFAULT\",\"op\":\"SETOP_NONE\"}}}}]}", "SELECT '\\''", "96", "{\"version\":170000,\"stmts\":[{\"stmt\":{\"SelectStmt\":{\"targetList\":[{\"ResTarget\":{\"val\":{\"A_Const\":{\"sval\":{\"sval\":\"'\"},\"location\":7}},\"location\":7}}],\"limitOption\":\"LIMIT_OPTION_DEFAULT\",\"op\":\"SETOP_NONE\"}}}]}", "v3.c1 := '\\''", "100", "{\"version\":170000,\"stmts\":[{\"stmt\":{\"PLAssignStmt\":{\"name\":\"v3\",\"indirection\":[{\"String\":{\"sval\":\"c1\"}}],\"nnames\":2,\"val\":{\"targetList\":[{\"ResTarget\":{\"val\":{\"A_Const\":{\"sval\":{\"sval\":\"'\"},\"location\":9}},\"location\":9}}],\"limitOption\":\"LIMIT_OPTION_DEFAULT\",\"op\":\"SETOP_NONE\"}}}}]}", }; size_t testsLength = __LINE__ - 4;