Ouzo\Tools\Model\Template\Dialect\PostgresDialect::_getPrimaryKey PHP Метод

_getPrimaryKey() приватный Метод

private _getPrimaryKey ( $tableName )
    private function _getPrimaryKey($tableName)
    {
        $primaryKey = Db::getInstance()->query("SELECT pg_attribute.attname\n         FROM pg_index, pg_class, pg_attribute\n         WHERE\n            pg_class.oid = '{$tableName}'::REGCLASS AND\n            indrelid = pg_class.oid AND\n            pg_attribute.attrelid = pg_class.oid AND\n            pg_attribute.attnum = ANY(pg_index.indkey)\n            AND indisprimary;\n        ")->fetch();
        if ($primaryKey) {
            return Arrays::getValue($primaryKey, 'attname');
        } else {
            return '';
        }
    }