Respect the PostgreSQL database schema when querying pg_catalog and information_schema
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned | ||
Odoo Server (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned |
Bug Description
The OpenERP ORM does not care for the schema of the (current) database when querying meta-information from pg_catalog or information_schema. This behavior comes to failure if one database contains data for more than one OpenERP instance in different schemas.
One could say, create one database per instance but there are reasons for having two or more schemas in on database.
1. For some reasons I have only one database and cannot create another. Now, if I need to run two instances of OpenERP (maybe for training or testing a new module) , I need two db-users and two db-schemas and everything would be fine.
2. For development, testing or debugging, migration I need to push data from one instance to another instance (maybe both of different versions) but cross-database-SQL is not that easy as it is for two schemas in one database.
3. This feature is supported by the underlying DBMS and PostgreSQL is the only one supported by OpenERP.
I did a case insensitive search for the reg-exp "\bpg_|
(See the attached branch.)
BTW: In many (web-) application the user is able to host multiple instances by prefixing the table name.
I added a Bash script to easily scan for relevant code changes (http:// bazaar. launchpad. net/~openerp- community/ openobject- server/ 7.0-server- pg_db_schema- redneck/ view/head: /scripts/ check_pg_ db_schema. sh).
How I use it:
I have a directory containing all the OpenERP stuff, which is a Bazaar repository. The structure look as follows:
./7.0-addons # untouched copy of master branch pg_db_schema- redneck # feature branch with changes pg_db_schema- redneck # feature branch with changes
./7.0-addons-
./7.0-server # untouched copy of master branch
./7.0-server-
./addons # fork of master with merged features
./server # fork of master with merged features
Now, after pulling changes from Launchpad to my vendor branches, I run the script (> server/ scripts/ check_pg_ db_schema. sh 7.0-server/openerp 7.0-addons/). If there are relevant changes I will synchronize the relevant feature branches, add some code as said in the bug description, push it to Launchpad and merge the changes into my fork.