Pull request (2 of 2) to fix #196

This is the second of two pull requests that seem to fix #196.

After reverting 858c5032 (which reverts a737f484), the new test in my first pull request fails, as expected. So this pull request fixes that by excluding foreign keys (as well as primary keys) from the second part (`us`) of `getColumns`' result. Now my new test passes again, and we no longer need the `nub`, which must be good, right? :-) And I have tried @bergmark's original test case, the one with a foreign key reference from a table outside the model. That fails before this patch, and passes after.

So it all looks positive. **But** I can't put my hand on my heart and say that I've truly groked the code and I'm sure this is the right fix.

Right now, I want to get back to work on my project. I hope this is helpful, and I'll try to keep an eye out for future work in this area, to see if I can contribute. (And perhaps even one day understand the code well enough to massage it in the direction of being clearer and righter. :-)