summaryrefslogtreecommitdiff
path: root/classes/database
diff options
context:
space:
mode:
authorJean-Michel Vourgère2019-11-06 17:01:27 +0000
committerRobert Treat2019-12-08 02:43:22 +0000
commitf40fcaa3dd89b5baf7c68b03e47618261960b872 (patch)
tree17cc445d047298b8c67be44b548d681e6e57e74e /classes/database
parentfa5119cc1afcf62e5d647a0855ad37637bc29cf2 (diff)
Disable OID handling on PG12
Notes: - "CREATE TABLE WITHOUT OIDS" continues to work, for now - "SHOW default_with_oids" continues to work, for now
Diffstat (limited to 'classes/database')
-rw-r--r--classes/database/Postgres.php20
-rw-r--r--classes/database/Postgres11.php26
2 files changed, 33 insertions, 13 deletions
diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php
index 1daebd3c..786dafca 100644
--- a/classes/database/Postgres.php
+++ b/classes/database/Postgres.php
@@ -165,6 +165,10 @@ class Postgres extends ADODB_base {
// The default type storage
var $typStorageDef = 'plain';
+ // PG <= 11 could have hidden OID columns
+ // This disables extra OID related GUI options (exports, ...)
+ var $supportOids = false;
+
/**
* Constructor
* @param $conn The database connection
@@ -1039,19 +1043,9 @@ class Postgres extends ADODB_base {
* @return null error
**/
function hasObjectID($table) {
- $c_schema = $this->_schema;
- $this->clean($c_schema);
- $this->clean($table);
-
- $sql = "SELECT relhasoids FROM pg_catalog.pg_class WHERE relname='{$table}'
- AND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace WHERE nspname='{$c_schema}')";
-
- $rs = $this->selectSet($sql);
- if ($rs->recordCount() != 1) return null;
- else {
- $rs->fields['relhasoids'] = $this->phpBool($rs->fields['relhasoids']);
- return $rs->fields['relhasoids'];
- }
+ // OID support is gone since PG12
+ // But that function is required by table exports
+ return false;
}
/**
diff --git a/classes/database/Postgres11.php b/classes/database/Postgres11.php
index 38aa20fb..46ef936d 100644
--- a/classes/database/Postgres11.php
+++ b/classes/database/Postgres11.php
@@ -11,6 +11,10 @@ class Postgres11 extends Postgres {
var $major_version = 11;
+ // PG<=11 could have hidden OID columns
+ // This enables extra OID related GUI options (exports, ...)
+ var $supportOids = true;
+
/**
* Constructor
* @param $conn The database connection
@@ -26,5 +30,27 @@ class Postgres11 extends Postgres {
return $this->help_page;
}
+ /**
+ * Checks to see whether or not a table has a unique id column
+ * @param $table The table name
+ * @return True if it has a unique id, false otherwise
+ * @return null error
+ **/
+ function hasObjectID($table) {
+ $c_schema = $this->_schema;
+ $this->clean($c_schema);
+ $this->clean($table);
+
+ $sql = "SELECT relhasoids FROM pg_catalog.pg_class WHERE relname='{$table}'
+ AND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace WHERE nspname='{$c_schema}')";
+
+ $rs = $this->selectSet($sql);
+ if ($rs->recordCount() != 1) return null;
+ else {
+ $rs->fields['relhasoids'] = $this->phpBool($rs->fields['relhasoids']);
+ return $rs->fields['relhasoids'];
+ }
+ }
+
}
?>