Nette\Database\Drivers\PgSqlDriver::getForeignKeys PHP Method

getForeignKeys() public method

Returns metadata for all foreign keys in a table.
public getForeignKeys ( $table )
    public function getForeignKeys($table)
    {
        /* Does't work with multicolumn foreign keys */
        return $this->connection->query("\n\t\t\tSELECT\n\t\t\t\tco.conname::varchar AS name,\n\t\t\t\tal.attname::varchar AS local,\n\t\t\t\tnf.nspname || '.' || cf.relname::varchar AS table,\n\t\t\t\taf.attname::varchar AS foreign\n\t\t\tFROM\n\t\t\t\tpg_catalog.pg_constraint AS co\n\t\t\t\tJOIN pg_catalog.pg_class AS cl ON co.conrelid = cl.oid\n\t\t\t\tJOIN pg_catalog.pg_class AS cf ON co.confrelid = cf.oid\n\t\t\t\tJOIN pg_catalog.pg_namespace AS nf ON nf.oid = cf.relnamespace\n\t\t\t\tJOIN pg_catalog.pg_attribute AS al ON al.attrelid = cl.oid AND al.attnum = co.conkey[1]\n\t\t\t\tJOIN pg_catalog.pg_attribute AS af ON af.attrelid = cf.oid AND af.attnum = co.confkey[1]\n\t\t\tWHERE\n\t\t\t\tco.contype = 'f'\n\t\t\t\tAND cl.oid = {$this->connection->quote($this->delimiteFQN($table))}::regclass\n\t\t\t\tAND nf.nspname = ANY (pg_catalog.current_schemas(FALSE))\n\t\t")->fetchAll();
    }