]> git.joonet.de Git - adminer.git/commitdiff
PostgreSQL: Allow creating trigger functions
authorJakub Vrana <jakub@vrana.cz>
Tue, 30 Jan 2018 14:55:50 +0000 (15:55 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 30 Jan 2018 14:55:50 +0000 (15:55 +0100)
adminer/include/editing.inc.php
adminer/procedure.inc.php

index 983e6c0d4999bf2ec88edfd5abbaab7664cbe27b..619bb27e9ed9c3e167b28e771d485a079135a1ea 100644 (file)
@@ -135,20 +135,21 @@ function textarea($name, $value, $rows = 10, $cols = 80) {
 * @param array
 * @param array
 * @param array returned by referencable_primary()
+* @param array extra types to prepend
 * @return null
 */
-function edit_type($key, $field, $collations, $foreign_keys = array()) {
+function edit_type($key, $field, $collations, $foreign_keys = array(), $extra_types = array()) {
        global $structured_types, $types, $unsigned, $on_actions;
        $type = $field["type"];
        ?>
 <td><select name="<?php echo h($key); ?>[type]" class="type" aria-labelledby="label-type"><?php
-if ($type && !isset($types[$type]) && !isset($foreign_keys[$type])) {
-       array_unshift($structured_types, $type);
+if ($type && !isset($types[$type], $foreign_keys[$type]) && !in_array($type, $extra_types)) {
+       $extra_types[] = $type;
 }
 if ($foreign_keys) {
        $structured_types[lang('Foreign keys')] = $foreign_keys;
 }
-echo optionlist($structured_types, $type);
+echo optionlist(array_merge($extra_types, $structured_types), $type);
 ?></select>
 <?php echo on_help("getTarget(event).value", 1); ?>
 <?php echo script("mixin(qsl('select'), {onfocus: function () { lastType = selectValue(this); }, onchange: editingTypeChange});", ""); ?>
index 942dd1897669002ea6c2753d278fe438b52e09b7..4a2731ac2c4b7cf6855e9502e5e9042b9e3c2b14 100644 (file)
@@ -43,7 +43,7 @@ $routine_languages = routine_languages();
 edit_fields($row["fields"], $collations, $routine);
 if (isset($_GET["function"])) {
        echo "<tr><td>" . lang('Return type');
-       edit_type("returns", $row["returns"], $collations);
+       edit_type("returns", $row["returns"], $collations, array(), ($jush == "pgsql" ? array("void", "trigger") : array()));
 }
 ?>
 </table>