]> git.joonet.de Git - adminer.git/commitdiff
PostgreSQL: fix alter foreign key
authorJakub Vrana <jakub@vrana.cz>
Mon, 29 Aug 2011 11:07:47 +0000 (13:07 +0200)
committerJakub Vrana <jakub@vrana.cz>
Mon, 29 Aug 2011 11:07:47 +0000 (13:07 +0200)
adminer/foreign.inc.php
changes.txt

index 7009a9fb47c5b0884fd467a9068bd323b57ff07f..b9d91480d17f91c2bd3568804ea2514dd2a45de0 100644 (file)
@@ -11,7 +11,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["change"] && !$_POST["change-
                        $target[$key] = $_POST["target"][$key];
                }
                query_redirect("ALTER TABLE " . table($TABLE)
-                       . ($_GET["name"] != "" ? "\nDROP FOREIGN KEY " . idf_escape($_GET["name"]) . "," : "")
+                       . ($_GET["name"] != "" ? "\nDROP " . ($jush == "sql" ? "FOREIGN KEY " : "CONSTRAINT ") . idf_escape($_GET["name"]) . "," : "")
                        . "\nADD FOREIGN KEY (" . implode(", ", array_map('idf_escape', $source)) . ") REFERENCES " . table($_POST["table"]) . " (" . implode(", ", array_map('idf_escape', $target)) . ")" //! reuse $_GET["name"] - check in older MySQL versions
                        . (ereg("^($on_actions)\$", $_POST["on_delete"]) ? " ON DELETE $_POST[on_delete]" : "")
                        . (ereg("^($on_actions)\$", $_POST["on_update"]) ? " ON UPDATE $_POST[on_update]" : "")
index e5dca75040404903767e0603256b28bdd6ecc1bc..5e9eee5252a41b68fb56668d72d343ac3bd1455c 100644 (file)
@@ -1,4 +1,5 @@
 Adminer 3.3.4-dev:
+PostgreSQL: fix alter foreign key
 PostgreSQL over PDO: connect if the eponymous database does not exist (bug #3391619)
 Boolean search (Editor)
 Persian translation