def get_relations(cursor, table_name):
    cursor.execute("""
        SELECT con.conkey, con.confkey, c2.relname
        FROM pg_constraint con, pg_class c1, pg_class c2
        WHERE c1.oid = con.conrelid
            AND c2.oid = con.confrelid
            AND c1.relname = %s
            AND con.contype = 'f'""", [table_name])
    relations = {}
    for row in cursor.fetchall():
        try:
            # row[0] and row[1] are like "{2}", so strip the curly braces.
            relations[int(row[0][1:-1]) - 1] = (int(row[1][1:-1]) - 1, row[2])
        except ValueError:
            continue
    return relations
Subclass must set 'conf_paths_name' before calling superclass init.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/db/backends/postgresql/introspection.py/get_relations--crossover with--dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/actorstore/store.py/Store.__init__