Friday, October 6, 2023
1 change · master
Resolved issues and error corrections
Odoo can now initialize new databases correctly on PostgreSQL 15 and later when using the recommended limited-permission database user. This prevents setup failures caused by newer PostgreSQL permissions and keeps new deployments working without requiring administrator-level database access.
Original PR description
**Description of the issue/feature this PR addresses:** From PostgreSQL's point of view, as of version 15.0 and above the default behavior is to constrain ordinary users to user-private schemas. For…
**Description of the issue/feature this PR addresses:** From PostgreSQL's point of view, as of version 15.0 and above the default behavior is to constrain ordinary users to user-private schemas. For every user needing to create non-temporary objects, it's advised that they create a schema with the same name as that user (Recall that the default search path starts with $user, which resolves to the user name. Therefore, if each user has a separate schema, they access their own schemas by default.) This pattern is a secure schema usage pattern. See Section 5.9.6 https://www.postgresql.org/docs/current/ddl-schemas.html and https://www.postgresql.org/docs/release/15.0/ Databases migrated from previous versions of postgresql will have the default public schema writable, but new odoo instances on postgresql version 15 and above do not work. To fix this We'd create a new schema in the database that's the same name as our database user after we create our empty database **Current behavior before PR:** Initializing a new Odoo database on Postgres version 15.0 and above with a user with only the LOGIN and CREATE DATABASE roles would result in an error `permission denied for schema public` Because of this, no database tables are created on new databases using postgres V15.0 and above Desired behavior after PR is merged: Full functionality is restored by creating all tables in a schema that matches the database user --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr