Use Oid as the name of the column
This commit is contained in:
parent
dc94b2ec38
commit
f4625da53d
|
@ -264,7 +264,7 @@ ORDER BY 1";
|
||||||
|
|
||||||
function table_status($name = "") {
|
function table_status($name = "") {
|
||||||
$return = array();
|
$return = array();
|
||||||
foreach (get_rows("SELECT c.relname AS \"Name\", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'm' THEN 'materialized view' ELSE 'view' END AS \"Engine\", pg_relation_size(c.oid) AS \"Data_length\", pg_total_relation_size(c.oid) - pg_relation_size(c.oid) AS \"Index_length\", obj_description(c.oid, 'pg_class') AS \"Comment\", c.relhasoids::int AS \"Oid\", c.reltuples as \"Rows\", n.nspname
|
foreach (get_rows("SELECT c.relname AS \"Name\", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'm' THEN 'materialized view' ELSE 'view' END AS \"Engine\", pg_relation_size(c.oid) AS \"Data_length\", pg_total_relation_size(c.oid) - pg_relation_size(c.oid) AS \"Index_length\", obj_description(c.oid, 'pg_class') AS \"Comment\", CASE WHEN c.relhasoids THEN 'oid' ELSE 'ctid' END AS \"Oid\", c.reltuples as \"Rows\", n.nspname
|
||||||
FROM pg_class c
|
FROM pg_class c
|
||||||
JOIN pg_namespace n ON(n.nspname = current_schema() AND n.oid = c.relnamespace)
|
JOIN pg_namespace n ON(n.nspname = current_schema() AND n.oid = c.relnamespace)
|
||||||
WHERE relkind IN ('r', 'm', 'v', 'f')
|
WHERE relkind IN ('r', 'm', 'v', 'f')
|
||||||
|
@ -690,7 +690,7 @@ AND typelem = 0"
|
||||||
$return_parts[] = "CONSTRAINT " . idf_escape($fkey_name) . " $fkey[definition] " . ($fkey['deferrable'] ? 'DEFERRABLE' : 'NOT DEFERRABLE');
|
$return_parts[] = "CONSTRAINT " . idf_escape($fkey_name) . " $fkey[definition] " . ($fkey['deferrable'] ? 'DEFERRABLE' : 'NOT DEFERRABLE');
|
||||||
}
|
}
|
||||||
|
|
||||||
$return .= implode(",\n ", $return_parts) . "\n) WITH (oids = " . ($status['Oid'] ? 'true' : 'false') . ");";
|
$return .= implode(",\n ", $return_parts) . "\n) WITH (oids = " . ($status['Oid'] == 'oid' ? 'true' : 'false') . ");";
|
||||||
|
|
||||||
// "basic" indexes after table definition
|
// "basic" indexes after table definition
|
||||||
foreach ($indexes as $index_name => $index) {
|
foreach ($indexes as $index_name => $index) {
|
||||||
|
|
|
@ -271,7 +271,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||||
function table_status($name = "") {
|
function table_status($name = "") {
|
||||||
global $connection;
|
global $connection;
|
||||||
$return = array();
|
$return = array();
|
||||||
foreach (get_rows("SELECT name AS Name, type AS Engine, 1 AS Oid, '' AS Auto_increment FROM sqlite_master WHERE type IN ('table', 'view') " . ($name != "" ? "AND name = " . q($name) : "ORDER BY name")) as $row) {
|
foreach (get_rows("SELECT name AS Name, type AS Engine, 'rowid' AS Oid, '' AS Auto_increment FROM sqlite_master WHERE type IN ('table', 'view') " . ($name != "" ? "AND name = " . q($name) : "ORDER BY name")) as $row) {
|
||||||
$row["Rows"] = $connection->result("SELECT COUNT(*) FROM " . idf_escape($row["Name"]));
|
$row["Rows"] = $connection->result("SELECT COUNT(*) FROM " . idf_escape($row["Name"]));
|
||||||
$return[$row["Name"]] = $row;
|
$return[$row["Name"]] = $row;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,8 @@ $table_status = table_status1($TABLE);
|
||||||
$indexes = indexes($TABLE);
|
$indexes = indexes($TABLE);
|
||||||
$fields = fields($TABLE);
|
$fields = fields($TABLE);
|
||||||
$foreign_keys = column_foreign_keys($TABLE);
|
$foreign_keys = column_foreign_keys($TABLE);
|
||||||
$oid = "";
|
$oid = $table_status["Oid"];
|
||||||
if ($table_status["Oid"]) {
|
if ($oid) {
|
||||||
$oid = ($jush == "sqlite" ? "rowid" : "oid");
|
|
||||||
$indexes[] = array("type" => "PRIMARY", "columns" => array($oid));
|
$indexes[] = array("type" => "PRIMARY", "columns" => array($oid));
|
||||||
}
|
}
|
||||||
parse_str($_COOKIE["adminer_import"], $adminer_import);
|
parse_str($_COOKIE["adminer_import"], $adminer_import);
|
||||||
|
|
Loading…
Reference in a new issue