diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index eb40104f..2cc438c8 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -729,7 +729,7 @@ ORDER BY SPECIFIC_NAME'); } function types() { - return get_vals("SELECT typname + return get_key_vals("SELECT oid, typname FROM pg_type WHERE typnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND typtype IN ('b','d','e') @@ -752,9 +752,9 @@ AND typelem = 0" $connection2 = $connection; } $return = $connection2->query("SET search_path TO " . idf_escape($schema)); - foreach (types() as $type) { //! get types from current_schemas('t') + foreach (types() as $key => $type) { //! get types from current_schemas('t') if (!isset($types[$type])) { - $types[$type] = 0; + $types[$type] = $key; $structured_types[lang('User types')][] = $type; } } diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 6612b84e..6e0158e5 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -869,13 +869,13 @@ function column_foreign_keys($table) { * @return null */ function enum_input($type, $attrs, $field, $value, $empty = null) { - global $adminer; + global $adminer, $jush; preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches); $return = ($empty !== null ? "" : ""); foreach ($matches[1] as $i => $val) { $val = stripcslashes(str_replace("''", "'", $val)); $checked = (is_int($value) ? $value == $i+1 : (is_array($value) ? in_array($i+1, $value) : $value === $val)); - $return .= " '; + $return .= " '; } return $return; } @@ -887,7 +887,7 @@ function enum_input($type, $attrs, $field, $value, $empty = null) { * @return null */ function input($field, $value, $function) { - global $types, $adminer, $jush; + global $types, $structured_types, $adminer, $jush; $name = h(bracket_escape($field["field"])); echo "