Postgresql checksums are intended as a way to catch disk corruption. The system works by computing a checksum for each physical page in the database, and writing it with the page. When the page is later read back in, the checksum can be verified; if it doesn't match, the underlying file has been corrupted.
Between two different instances of the same data, the checksums would only match if the two files have precisely the same bytes in the same order, something which is unlikely if you are upgrading since the new version probably has internal tables with different layouts. Even were that not the case, there is a certain amount of non-determinism in the low-level data format, and it is extremely unlikely that two instances of the same database (even with the same version) would be byte-for-byte identical.
Your best bet is probably to dump all the data in some deterministic format, and sort it unambiguously. Then compute an md5sum on that (or some other hash if you prefer).
Also see this similar question: How to check difference between two databases in PostgreSQL?