Postgres::getReferrers PHP Method

getReferrers() public method

Finds the foreign keys that refer to the specified table
public getReferrers ( $table ) : A
$table The table to find referrers for
return A recordset
    function getReferrers($table)
    {
        $this->clean($table);
        $status = $this->beginTransaction();
        if ($status != 0) {
            return -1;
        }
        $c_schema = $this->_schema;
        $this->clean($c_schema);
        $sql = "\n\t\t\tSELECT\n\t\t\t\tpn.nspname,\n\t\t\t\tpl.relname,\n\t\t\t\tpc.conname,\n\t\t\t\tpg_catalog.pg_get_constraintdef(pc.oid) AS consrc\n\t\t\tFROM\n\t\t\t\tpg_catalog.pg_constraint pc,\n\t\t\t\tpg_catalog.pg_namespace pn,\n\t\t\t\tpg_catalog.pg_class pl\n\t\t\tWHERE\n\t\t\t\tpc.connamespace = pn.oid\n\t\t\t\tAND pc.conrelid = pl.oid\n\t\t\t\tAND pc.contype = 'f'\n\t\t\t\tAND confrelid = (SELECT oid FROM pg_catalog.pg_class WHERE relname='{$table}'\n\t\t\t\t\tAND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace\n\t\t\t\t\tWHERE nspname='{$c_schema}'))\n\t\t\tORDER BY 1,2,3\n\t\t";
        return $this->selectSet($sql);
    }
Postgres