From a57d46f9cdfd5d9acfb50aea56db231daeb19127 Mon Sep 17 00:00:00 2001 From: Darold Gilles Date: Sat, 6 Feb 2016 10:27:06 +0100 Subject: [PATCH] Update operators list in SQL code beautifier with last update in pgFormatter. Thanks to Laurenz Albe for the report and the list of missing operators. --- pgbadger | 90 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 38 deletions(-) diff --git a/pgbadger b/pgbadger index 4342e66..b2d924e 100755 --- a/pgbadger +++ b/pgbadger @@ -11743,44 +11743,58 @@ sub build_log_line_prefix_regex my ($query, $remove_white_tokens) = @_; my $re = qr{ - ( - (?:--)[\ \t\S]* # single line comments - | - (?:\#|\@\-\@|\@\@|\#\#|<\->|\&<|\&>|<<\||\|>>|\&<\||\|\&>|<\^|>\^|\?\#|\?\-|\?\||\?\-\||\?\|\||\@>|<\@|\~=) - # Geometric Operators - | - (?:\->>|\->|\#>|\?\&|\?) # Json Operators - | - (?:<>|<=>|>=|<=|==|=|!=|!|<<|>>|<|>|\|\||\||&&|&|-|\+|\*(?!/)|/(?!\*)|\%|~|\^|\?) - # operators and tests - | - [\[\]\(\),;.] # punctuation (parenthesis, comma) - | - \'\'(?!\') # empty single quoted string - | - \"\"(?!\"") # empty double quoted string - | - "(?>(?:(?>[^"\\]+)|""|\\.)*)+" - # anything inside double quotes, ungreedy - | - `(?>(?:(?>[^`\\]+)|``|\\.)*)+` - # anything inside backticks quotes, ungreedy - | - '(?>(?:(?>[^'\\]+)|''|\\.)*)+' - # anything inside single quotes, ungreedy. - | - /\*[\ \t\r\n\S]*?\*/ # C style comments - | - (?:[\w:@]+(?:\.(?:\w+|\*)?)*) - # words, standard named placeholders, db.table.*, db.* - | - (?: \$_\$ | \$\d+ | \${1,2}) - # dollar expressions - eg $_$ $3 $$ - | - \n # newline - | - [\t\ ]+ # any kind of white spaces - ) + ( + (?:--)[\ \t\S]* # single line comments + | + (?:\-\|\-) # range operator "is adjacent to" + | + (?:\->>|\->|\#>>|\#>|\?\&|\?) # Json Operators + | + (?:\#<=|\#>=|\#<>|\#<|\#=) # compares tinterval and reltime + | + (?:>>=|<<=) # inet operators + | + (?:!!|\@\@\@) # deprecated factorial and full text search operators + | + (?:\|\|\/|\|\/) # square root and cube root + | + (?:\@\-\@|\@\@|\#\#|<\->|<<\||\|>>|\&<\||\&<|\|\&>|\&>|<\^|>\^|\?\#|\#|\?<\||\?\-\||\?\-|\?\|\||\?\||\@>|<\@|\~=) + # Geometric Operators + | + (?:~<=~|~>=~|~>~|~<~) # string comparison for pattern matching operator families + | + (?:!~~|!~~\*|~~\*|~~) # LIKE operators + | + (?:!~\*|!~|~\*) # regular expression operators + | + (?:\*=|\*<>|\*<=|\*>=|\*<|\*>) # composite type comparison operators + | + (?:<>|<=>|>=|<=|==|=|!=|!|<<|>>|<|>|\|\||\||&&|&|-|\+|\*(?!/)|/(?!\*)|\%|~|\^|\?) # operators and tests + | + [\[\]\(\),;.] # punctuation (parenthesis, comma) + | + \'\'(?!\') # empty single quoted string + | + \"\"(?!\"") # empty double quoted string + | + "(?>(?:(?>[^"\\]+)|""|\\.)*)+" # anything inside double quotes, ungreedy + | + `(?>(?:(?>[^`\\]+)|``|\\.)*)+` # anything inside backticks quotes, ungreedy + | + '(?>(?:(?>[^'\\]+)|''|\\.)*)+' # anything inside single quotes, ungreedy. + | + /\*[\ \t\r\n\S]*?\*/ # C style comments + | + (?:[\w:@]+(?:\.(?:\w+|\*)?)*) # words, standard named placeholders, db.table.*, db.* + | + (?:\$\w+\$) + | + (?: \$_\$ | \$\d+ | \${1,2} | \$\w+\$ ) # dollar expressions - eg $_$ $3 $$ $BODY$ + | + \n # newline + | + [\t\ ]+ # any kind of white spaces + ) }smx; my @query = (); -- 2.40.0