Permalink
Browse files

Place each node of a union in parentheses for PostgreSQL too

  • Loading branch information...
kuppuswamy committed Aug 27, 2017
1 parent 62e427c commit 9803a383f82c95b29c51637b4e908b38b040d659
@@ -188,9 +188,9 @@ trait MySQLProfile extends JdbcProfile { profile =>
case RowNumGen(sym, init) => b"@`$sym := $init"
case Union(left, right, all) =>
b"\{"
buildFrom(left, None, false)
if(all) b"\nunion all " else b"\nunion "
buildFrom(right, None, false)
buildFrom(left, None)
if (all) b"\nunion all " else b"\nunion "
buildFrom(right, None)
b"\}"
case _ => super.expr(n, skipParens)
}
@@ -191,6 +191,12 @@ trait PostgresProfile extends JdbcProfile {
case Library.CurrentValue(SequenceNode(name)) => b"currval('$name')"
case Library.CurrentDate() => b"current_date"
case Library.CurrentTime() => b"current_time"
case Union(left, right, all) =>
b"\{"
buildFrom(left, None)
if (all) b"\nunion all " else b"\nunion "
buildFrom(right, None)
b"\}"
case _ => super.expr(n, skipParens)
}
}

0 comments on commit 9803a38

Please sign in to comment.