summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-12-06 12:04:01 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-12-06 12:04:01 +0100
commit40fab414fdfefeeef3da9bb87658f365c005bd2b (patch)
treeb6a8453dae3efbdab72d02f45256320ba3465158 /system
parentf9ff3afd28fbd5539a1081f25b83766369d78267 (diff)
parentc9fc88c09c1a0accdddd3710907fee2f5b42d7ad (diff)
Merge pull request #735 from tomasz154/develop
Made an "innocuous SQL statement" more innocuous SELECT * FROM was running in the PostgreSQL drivers just for the sake of returning valid SQL, which could of course be insanely slow on large tables.
Diffstat (limited to 'system')
-rw-r--r--system/database/DB_forge.php6
-rw-r--r--system/database/drivers/postgre/postgre_forge.php3
2 files changed, 8 insertions, 1 deletions
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index 1aa2334ea..78bf77a9f 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -205,6 +205,12 @@ class CI_DB_forge {
$sql = $this->_create_table($this->db->dbprefix.$table, $this->fields, $this->primary_keys, $this->keys, $if_not_exists);
$this->_reset();
+
+ if (is_bool($sql))
+ {
+ return $sql;
+ }
+
return $this->db->query($sql);
}
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index 166cc4e6a..df0338e73 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -81,9 +81,10 @@ class CI_DB_postgre_forge extends CI_DB_forge {
if ($if_not_exists === TRUE)
{
+ // PostgreSQL doesn't support IF NOT EXISTS syntax so we check if table exists manually
if ($this->db->table_exists($table))
{
- return "SELECT * FROM $table"; // Needs to return innocous but valid SQL statement
+ return TRUE;
}
}