Skip complex expression parenthesis wrap for function parameters.

This commit is contained in:
go-jet 2022-01-10 16:57:57 +01:00
parent a506a96d6a
commit 7377e078cd
12 changed files with 102 additions and 83 deletions

View file

@ -264,22 +264,22 @@ SELECT (all_types.'numeric' = all_types.'numeric') AS "eq1",
(all_types.'numeric' > ?) AS "gt2",
(all_types.'numeric' BETWEEN ? AND all_types.'decimal') AS "between",
(all_types.'numeric' NOT BETWEEN (all_types.'decimal' * ?) AND ?) AS "not_between",
TRUNCATE((all_types.'decimal' + all_types.'decimal'), ?) AS "add1",
TRUNCATE((all_types.'decimal' + ?), ?) AS "add2",
TRUNCATE((all_types.'decimal' - all_types.decimal_ptr), ?) AS "sub1",
TRUNCATE((all_types.'decimal' - ?), ?) AS "sub2",
TRUNCATE((all_types.'decimal' * all_types.decimal_ptr), ?) AS "mul1",
TRUNCATE((all_types.'decimal' * ?), ?) AS "mul2",
TRUNCATE((all_types.'decimal' / all_types.decimal_ptr), ?) AS "div1",
TRUNCATE((all_types.'decimal' / ?), ?) AS "div2",
TRUNCATE((all_types.'decimal' % all_types.decimal_ptr), ?) AS "mod1",
TRUNCATE((all_types.'decimal' % ?), ?) AS "mod2",
TRUNCATE(all_types.'decimal' + all_types.'decimal', ?) AS "add1",
TRUNCATE(all_types.'decimal' + ?, ?) AS "add2",
TRUNCATE(all_types.'decimal' - all_types.decimal_ptr, ?) AS "sub1",
TRUNCATE(all_types.'decimal' - ?, ?) AS "sub2",
TRUNCATE(all_types.'decimal' * all_types.decimal_ptr, ?) AS "mul1",
TRUNCATE(all_types.'decimal' * ?, ?) AS "mul2",
TRUNCATE(all_types.'decimal' / all_types.decimal_ptr, ?) AS "div1",
TRUNCATE(all_types.'decimal' / ?, ?) AS "div2",
TRUNCATE(all_types.'decimal' % all_types.decimal_ptr, ?) AS "mod1",
TRUNCATE(all_types.'decimal' % ?, ?) AS "mod2",
TRUNCATE(POW(all_types.'decimal', all_types.decimal_ptr), ?) AS "pow1",
TRUNCATE(POW(all_types.'decimal', ?), ?) AS "pow2",
TRUNCATE(ABS(all_types.'decimal'), ?) AS "abs",
TRUNCATE(POWER(all_types.'decimal', ?), ?) AS "power",
TRUNCATE(SQRT(all_types.'decimal'), ?) AS "sqrt",
TRUNCATE(POWER(all_types.'decimal', (? / ?)), ?) AS "cbrt",
TRUNCATE(POWER(all_types.'decimal', ? / ?), ?) AS "cbrt",
CEIL(all_types.'real') AS "ceil",
FLOOR(all_types.'real') AS "floor",
ROUND(all_types.'decimal') AS "round1",
@ -395,7 +395,7 @@ SELECT all_types.big_int AS "all_types.big_int",
(all_types.big_int DIV ?) AS "div2",
(all_types.big_int % all_types.big_int) AS "mod1",
(all_types.big_int % ?) AS "mod2",
POW(all_types.small_int, (all_types.small_int DIV ?)) AS "pow1",
POW(all_types.small_int, all_types.small_int DIV ?) AS "pow1",
POW(all_types.small_int, ?) AS "pow2",
(all_types.small_int & all_types.small_int) AS "bit_and1",
(all_types.small_int & all_types.small_int) AS "bit_and2",
@ -411,7 +411,7 @@ SELECT all_types.big_int AS "all_types.big_int",
(all_types.small_int >> ?) AS "bit shift right 2",
ABS(all_types.big_int) AS "abs",
SQRT(ABS(all_types.big_int)) AS "sqrt",
POWER(ABS(all_types.big_int), (? / ?)) AS "cbrt"
POWER(ABS(all_types.big_int), ? / ?) AS "cbrt"
FROM test_sample.all_types
LIMIT ?;
`, "''", "`"))

View file

@ -563,16 +563,16 @@ SELECT (all_types.numeric = all_types.numeric) AS "eq1",
(all_types.numeric > $10) AS "gt2",
(all_types.numeric BETWEEN $11 AND all_types.decimal) AS "between",
(all_types.numeric NOT BETWEEN (all_types.decimal * $12) AND $13) AS "not_between",
TRUNC((all_types.decimal + all_types.decimal), $14::smallint) AS "add1",
TRUNC((all_types.decimal + $15), $16::smallint) AS "add2",
TRUNC((all_types.decimal - all_types.decimal_ptr), $17::integer) AS "sub1",
TRUNC((all_types.decimal - $18), $19::smallint) AS "sub2",
TRUNC((all_types.decimal * all_types.decimal_ptr), $20::smallint) AS "mul1",
TRUNC((all_types.decimal * $21), $22::integer) AS "mul2",
TRUNC((all_types.decimal / all_types.decimal_ptr), $23::integer) AS "div1",
TRUNC((all_types.decimal / $24), $25::smallint) AS "div2",
TRUNC((all_types.decimal % all_types.decimal_ptr), $26::smallint) AS "mod1",
TRUNC((all_types.decimal % $27), $28::smallint) AS "mod2",
TRUNC(all_types.decimal + all_types.decimal, $14::smallint) AS "add1",
TRUNC(all_types.decimal + $15, $16::smallint) AS "add2",
TRUNC(all_types.decimal - all_types.decimal_ptr, $17::integer) AS "sub1",
TRUNC(all_types.decimal - $18, $19::smallint) AS "sub2",
TRUNC(all_types.decimal * all_types.decimal_ptr, $20::smallint) AS "mul1",
TRUNC(all_types.decimal * $21, $22::integer) AS "mul2",
TRUNC(all_types.decimal / all_types.decimal_ptr, $23::integer) AS "div1",
TRUNC(all_types.decimal / $24, $25::smallint) AS "div2",
TRUNC(all_types.decimal % all_types.decimal_ptr, $26::smallint) AS "mod1",
TRUNC(all_types.decimal % $27, $28::smallint) AS "mod2",
TRUNC(POW(all_types.decimal, all_types.decimal_ptr), $29::smallint) AS "pow1",
TRUNC(POW(all_types.decimal, $30), $31::smallint) AS "pow2",
TRUNC(ABS(all_types.decimal), $32::smallint) AS "abs",
@ -698,7 +698,7 @@ SELECT all_types.big_int AS "all_types.big_int",
(all_types.big_int / $16::integer) AS "div2",
(all_types.big_int % all_types.big_int) AS "mod1",
(all_types.big_int % $17::bigint) AS "mod2",
POW(all_types.small_int, (all_types.small_int / $18::smallint)) AS "pow1",
POW(all_types.small_int, all_types.small_int / $18::smallint) AS "pow1",
POW(all_types.small_int, $19::smallint) AS "pow2",
(all_types.small_int & all_types.small_int) AS "bit_and1",
(all_types.small_int & all_types.small_int) AS "bit_and2",