PostgreSQL: Fix setting column comments on new table
This commit is contained in:
parent
36ade4e197
commit
9b58ecf925
|
@ -483,6 +483,9 @@ WHERE table_schema = current_schema() AND table_name = " . q($name))));
|
|||
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
|
||||
$alter = array();
|
||||
$queries = array();
|
||||
if ($table != "" && $table != $name) {
|
||||
$queries[] = "ALTER TABLE " . table($table) . " RENAME TO " . table($name);
|
||||
}
|
||||
foreach ($fields as $field) {
|
||||
$column = idf_escape($field[0]);
|
||||
$val = $field[1];
|
||||
|
@ -498,7 +501,7 @@ WHERE table_schema = current_schema() AND table_name = " . q($name))));
|
|||
$alter[] = ($table != "" ? "ADD " : " ") . implode($val);
|
||||
} else {
|
||||
if ($column != $val[0]) {
|
||||
$queries[] = "ALTER TABLE " . table($table) . " RENAME $column TO $val[0]";
|
||||
$queries[] = "ALTER TABLE " . table($name) . " RENAME $column TO $val[0]";
|
||||
}
|
||||
$alter[] = "ALTER $column TYPE$val[1]";
|
||||
if (!$val[6]) {
|
||||
|
@ -507,7 +510,7 @@ WHERE table_schema = current_schema() AND table_name = " . q($name))));
|
|||
}
|
||||
}
|
||||
if ($field[0] != "" || $val5 != "") {
|
||||
$queries[] = "COMMENT ON COLUMN " . table($table) . ".$val[0] IS " . ($val5 != "" ? substr($val5, 9) : "''");
|
||||
$queries[] = "COMMENT ON COLUMN " . table($name) . ".$val[0] IS " . ($val5 != "" ? substr($val5, 9) : "''");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -517,9 +520,6 @@ WHERE table_schema = current_schema() AND table_name = " . q($name))));
|
|||
} elseif ($alter) {
|
||||
array_unshift($queries, "ALTER TABLE " . table($table) . "\n" . implode(",\n", $alter));
|
||||
}
|
||||
if ($table != "" && $table != $name) {
|
||||
$queries[] = "ALTER TABLE " . table($table) . " RENAME TO " . table($name);
|
||||
}
|
||||
if ($table != "" || $comment != "") {
|
||||
$queries[] = "COMMENT ON TABLE " . table($name) . " IS " . q($comment);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ Cache busting for adminer.css
|
|||
MySQL: Fix displaying multi-columns foreign keys (bug #675)
|
||||
MySQL: Fix creating users and changing password in MySQL 8 (bug #663)
|
||||
MySQL: Pass SRID to GeomFromText
|
||||
PostgreSQL: Fix setting column comments on new table
|
||||
Elasticsearch: Fix setting number of rows
|
||||
|
||||
Adminer 4.7.1 (released 2019-01-24):
|
||||
|
|
Loading…
Reference in a new issue