public static function exists($typeName)
    {
        $db = static::getDb();

        return $db->createCommand(
            'SELECT EXISTS ('
            . 'SELECT 1 '
                . 'FROM ' . $db->quoteTableName('pg_type')
                . ' WHERE typname = ' . $db->quoteValue($typeName)
            . ')'
        )->queryScalar();
    }