On Mon, Dec 14, 2015 at 8:10 AM, Thomas Munro <thomas.mu...@enterprisedb.com> wrote: > I've also add (very) primitive negative pattern support and used it in > 5 places. Improvement? Examples: > > /* ALTER TABLE xxx RENAME yyy */ > - else if (TailMatches5("ALTER", "TABLE", MatchAny, "RENAME", MatchAny) > && > - !TailMatches1("CONSTRAINT|TO")) > + else if (TailMatches5("ALTER", "TABLE", MatchAny, "RENAME", > "!CONSTRAINT|TO")) > COMPLETE_WITH_CONST("TO"); > > /* If we have CLUSTER <sth>, then add "USING" */ > - else if (TailMatches2("CLUSTER", MatchAny) && > !TailMatches1("VERBOSE|ON")) > + else if (TailMatches2("CLUSTER", "!VERBOSE|ON")) > COMPLETE_WITH_CONST("USING");
+ /* Handle negated patterns. */ + if (*pattern == '!') + return !word_matches(pattern + 1, word); Yeah, I guess that's an improvement for those cases, and there is no immediate need for a per-keyword NOT operator in our cases to allow things of the type (foo1 OR NOT foo2). Still, in the case of this patch !foo1|foo2 actually means (NOT foo1 AND NOT foo2). It does not seem that much intuitive. Reading straight this expression it seems that !foo1|foo2 means actually (NOT foo1 OR foo2) because the lack of parenthesis. Thoughts? -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers