Affects Version/s: 2.1.9, 2.2.5, 2.3.3, 2.4, 2.5
1/ run phpunit tests for pg, install and upgrade
2/ set up new scheme in pg server
3/ set $CFG->dboptions['dbschema'] = 'yournewschemaname';
4/ run tests again, install
Affected Branches:MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
Fixed Branches:MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
Pull from Repository:
Pull Master Branch:w51_
Pull Master Diff URL:
Postgres DB support schemas like oracle does and you can create many schemas in one Database, your tables will be grouped by schemas. The default schema in postgres is "public".
Until moodle 1.9.x, i can install many moodles using only one postgres database, with many postgres db schemas ("moodle1","moodle2",...) for example.
For this i used this commands:
CREATE USER "moodle-1";
CREATE SCHEMA "moodle-1" ;
ALTER SCHEMA "moodle-1" OWNER TO "moodle-1";
GRANT ALL ON SCHEMA "moodle-1" TO "moodle-1"
ALTER USER "moodle-1" SET search_path TO "moodle-1";
For moodle 2.x or above, it's seems the installation process ignores the command:
SET search_path TO "moodle-1", and tries to use the first schema that it found, give this installation errors:
"Config table does not contain version, can not continue, sorry."
"Coding error detected, it must be fixed by a programmer: block_manager has not yet loaded the blocks, to it is too soon to request the information you asked for."
But it's can be fixed by installing moodle on a new database, with only one schema and after installation, dump it and restore on the other database, moodle works fine!
The same thing occurs when i try to restore a course backup, if moodle db has many schemas it's goes wrong ("DDL" or "DTL" error, something like that), if not, works fine. With same moodle version, with same DB data, only difference is one with many DB schemas and other with only one.