Grouping AND and OR conditionals in PostgreSQL
In SQL the AND
operator takes "precedence" over OR
operator. PostgreSQL adheres to the spec here. You can the exact precedence in PostgreSQL in the docs Lexical Structure: Operator Precedence.
So in your case, the result will be the same. However, it's much easier, and cleaner to simply use the parentheses.
It goes as per the Operator Precendence http://www.postgresql.org/docs/6.5/static/operators.htm#AEN1615.
To form a complex condition it's always better to parenthesis your conditions.