Fix the order of query output for postgres

Sorts the query results and dictionary of expected results by two columns
rather than one which isn't unqiue.

Fixes bug 1208701

Change-Id: Icd21a008f7736a4d9027effb0633a506aae0f602
Merge "Fix the order of query output for postgres"