CodeIgniter Forums
PostgreSQL And the DB Driver - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: PostgreSQL And the DB Driver (/showthread.php?tid=13188)



PostgreSQL And the DB Driver - El Forum - 11-13-2008

[eluser]xoRiZ[/eluser]
Just thought I would mention that it would be useful to change the search path in a query ran, incase you're not using the default schema.

To resolve the problem I ran into I simply modified this function in my DB_driver.php

Code:
function simple_query($sql)
    {
        if ( ! $this->conn_id)
        {
            $this->initialize();
        }
        if ($this->dbdriver=='postgre') { $sql = 'SET search_path TO '.$this->database.', public; '.$sql; }
        
        return $this->_execute($sql);
    }

Maybe there's an alternate method?


PostgreSQL And the DB Driver - El Forum - 12-02-2008

[eluser]xoRiZ[/eluser]
I suppose there isn't.. Would be much more beneficial if I was able to just set the database (schema), and it would prefix all of the tables automatically.