I thought the planner had an automatic rewriter for these situations.
No. There was a prior discussion of this, saying that we really ought to support the SQL-spec row comparison syntax:
What I meant was that I thought the planner could rewrite : (A and C) or (A AND B) as A and (B or C) which is more index-friendly.
... WHERE (name, name2) > ('b', 'a'); which would map directly onto the semantics of a 2-column index. We don't have that functionality yet, though (we take the syntax but the semantics are not SQL-compliant) let alone any ability to pass it through to a 2-column index.
One could always use ARRAY[name,name2] > ARRAY['b','a'] But it is NOT index-friendly...
---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html