diff options
| author | Stéphane Bidoul <stephane.bidoul@acsone.eu> | 2021-03-14 15:40:57 +0000 |
|---|---|---|
| committer | Stéphane Bidoul <stephane.bidoul@acsone.eu> | 2021-03-19 11:52:26 +0000 |
| commit | 0ee38f3bb0bc74271246f4653ec85c85b437980f (patch) | |
| tree | 5403b0ef64fdb33019bc91cc1dd441867aadadaa /odoo/tools/sql.py | |
| parent | eb41f0de553906e09d199190544c878a9d1a7e85 (diff) | |
[FIX] base: allow using another postgres schema than public
Before 1721ec1363 and fdc4ef97c9d09, Odoo did work fine when the
user had another default schema than 'public'.
This commit restores this behaviour by searching
for existing objects in the user's current schema,
which is the first in the schema search path and
the one used when no schema is specified when
creating objects.
closes odoo/odoo#68141
X-original-commit: 223781b34afacd1c0c5674d395cece6d472b048c
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Diffstat (limited to 'odoo/tools/sql.py')
| -rw-r--r-- | odoo/tools/sql.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/odoo/tools/sql.py b/odoo/tools/sql.py index fc3d6f5524e..7445396856b 100644 --- a/odoo/tools/sql.py +++ b/odoo/tools/sql.py @@ -24,7 +24,7 @@ def existing_tables(cr, tablenames): JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE c.relname IN %s AND c.relkind IN ('r', 'v', 'm') - AND n.nspname = 'public' + AND n.nspname = current_schema """ cr.execute(query, [tuple(tablenames)]) return [row[0] for row in cr.fetchall()] @@ -43,7 +43,7 @@ def table_kind(cr, tablename): FROM pg_class c JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE c.relname = %s - AND n.nspname = 'public' + AND n.nspname = current_schema """ cr.execute(query, (tablename,)) return cr.fetchone()[0] if cr.rowcount else None |
