Recently I found myself trying to programmatically find out which columns on a database table were acting as the primary key. It turns out that there is a relatively straightforward (and standard!) way of doing this.
Postgres provides the SQL-compliant Information Schema database, which contains useful table information, including indices. As I understand it, much of the information you're looking for can be obtained through this schema. And in some ways the table structure (and subsequen...
Published on October 25, 2015 19:50